You can enable custom error messages for your ASP .NET application defaulted to Windows/IIS by using a web.config file with a "customErrors" setting configured.
We have included example web.config files below. For more detailed information refer to http://msdn.microsoft.com/en-us/library/h0hfz6fc.aspx
For Security purposes and coding best practices you should have the web.config customErrors mode="RemoteOnly" or mode="On" instead of mode="Off". The "Off" mode is primarily useful for debugging, and should not be used in a production environment because of the details it can expose about your server.
To configure a custom error page for 3.5 SP1 and above, follow this example:
<configuration>
<system.web>
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/error.aspx" />
</system.web>
</configuration>This example is for ASP.NET 2.0 - 3.5 without SP1:
<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="~/error.html" />
</system.web>
</configuration>ASP.NET Security references:
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

2 Comments
Confusion
re: Off
Add new comment