How do I setup custom error for my ASP.net application?

ASP.net has its own built-in error handling. To set up custom error handling for your ASP.net application, you will need to modify your web.config file.

As an example, if you want to redirect all 404 errors to error404.aspx, 500 errors to error500.aspx, and all other errors to error.htm, you would update the customErrors element in your web.config file.

CustomErrors is set to Off by default on all our servers. If you do not customize the custom error element in the web.config file, the default ASP.net error (with debug information) will be displayed.

Was this answer helpful?

 Print this Article

Also Read

I get an error 'A potentially dangerous Request.Form value was detected from the client ' when I hit submit on my ASP.NET Webform. What can I do?

This error is caused by a newly introduced feature of .NET Framework 1.1, called "Request...

How did I send email from ASP.net ?

You have to use System.Web.Mail namespace Below is the code snippets : using System.Web.Mail;...

I get a configuration error when I execute my application in a subdirectory. How do I resolve this?

This error may occur if the application is being run out of a subfolder and the subfolder is not...

ASP.NET Validation is not working on your server.

...

I get a database timeout expired error on my ASP.NET application. What can I do?

I get the following error when my ASP.NET application connects to the MS SQL server:...