This project is read-only.

How to display message boxes in asp .net web application?

Feb 15, 2011 at 10:27 AM

Hi.......

Am using exception handling application block in my web application project. My website contains a master page. I would like to use replace policy. This is my web.config file,

-----

<configSections>
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" requirePermission="true" />
  </configSections>
  <exceptionHandling>
    <exceptionPolicies>
      <add name="Replace Policy">
        <exceptionTypes>
          <add name="All Exceptions" type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
              postHandlingAction="None">
                       <exceptionHandlers>
              <add name="Replace Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ReplaceHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null"
                  exceptionMessage="An error has occurred" exceptionMessageResourceType=""
                  replaceExceptionType="System.Exception" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
    </exceptionPolicies>
  </exceptionHandling>

-----

Is it the correct format am using for replace handler? Whenever i debug the code am getting originalException as 'object reference not set.....' and chainException as 'An error has occurred'. But how can i display this in an alert box??

And am getting 'Exception was unhandled by user code'--"Unable to rethrow exception:The exception to throw is null". What should it mean?

Can anyone shed some light ASAP?