Monday, August 27, 2007

show detailed error in asp.net 2.0 web.config

show detailed error in asp.net 2.0 web.config
====================================


In web.config do the following

<customErrors mode="Off" />

This is handy for developers and testers in case when they are unable to exactly find the cause of an error. When in production this should not be used since it will show the entire detail to the laymen.

In such case use <customErrors mode="On"> to hide the detailed error.

You might want to keep show the error when run locally and hide the error when run remotely. You may achieve this using <customErrors mode="RemoteOnly">


Also if you want to redirect to a particular page when there is a error then you might use the below option:

<customErrors mode="On" defaultRedirect="ErrorTemplate.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>


No comments: