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 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:...

Disable Web Config inheritance for Virtual Application

If you have a lot of virtual applications under your webisteYou can Disable the main website's...

I am using ASP.NET and Internet Explorer Web Controls and it does not work when I open the page. What is wrong?

For Internet Explorer Web Controls to work properly you need to have the required HTML...

How can I send email from ASP.net if SMTP Authentication is required for your mail Server?

Our SMTP Server requires authentication before you can send email, But If your ASP or ASP.net...

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...