Managing Unhandled Exception

Managing Unhandled Exception You can manage unhandled exception with custom error pages in asp.net. You should configure the element in web.config file. It has two attributes:

  • Mode Attribute: It specifies how custom error page should be displayed. It contains 3 values.
    • On - Displays custom error pages at both the local and remote client.
    • Off - Disables custom error pages at both the local and remote client.
    • RemoteOnly - Displays custom error pages only at the remote client, for local machine it displays default asp.net error page. This is default setting in web.config file.
  • defaultRedirect: It is an optional attribute to specify the custom error page to be displayed when an error occurs.
  • You can display custom error page based on http error statusCode using error element inside the customeError element, in case the no specific statusCode match it will redirect to defaultRedirect page.

  • statusCode="403" redirect="NoAccess.htm" />
    statusCode="404" redirect="FileNotFound.htm" />

Read Users' Comments (0)

0 Response to "Managing Unhandled Exception"

Post a Comment