Home  |  Contact us    
Exception management - custom errors tag


Explain Web.config Settings for exception management in ASP.NET.

You should configure exception management settings within your application's Web.config file. The following is an example of the exception settings in a Web.config file.
< customErrors defaultredirect="http://hostname/error.aspx" mode="On"/>  
  < error statuscode="500" redirect="/errorpages/servererror.aspx" />
  < error statuscode="404" redirect="/errorpages/filenotfound.htm" />
< /customErrors>
  


In the customErrors element, specify a default redirect page. There are three modes for the default redirect page:

On
Unhandled exceptions will redirect the user to the specified defaultredirect page. This is used mainly in production.

Off
Users will see the exception information and not be redirected to the defaultredirect page. This is used mainly in development.

RemoteOnly
Only users accessing the site on the local machine (using localhost) will see the exception information while all other users will be redirected to the defaultredirect page. This is used mainly for debugging.


In addition to the default redirect page, you can set specific pages for certain HTTP error codes. For example, you can specify that all 404 errors result in a certain error page, while all 500 errors result in another

Category: ASP.NET Faqs, Interview Questions & Answers



Ask New Questions
Microsoft.Net Framework
.Net 2.0 Namespaces
.Net Assemblies
OOPS Faqs in C#
ASP.Net Faqs
ASP.Net 2.0 Faqs
Web Services Faqs
ADO.Net Faqs
Database Faqs
OOPS Faqs
IT Project Management