Set up custom error messages in ASP.NET on Cloud Sites
You can enable custom error messages for your ASP.NET application on Windows IIS by using a web.config file with a customErrors setting configured.
For security purposes and coding best practices, set the customErrors mode to RemoteOnly or On instead of Off. The Off mode is primarily useful for debugging, and it should not be used in a production environment because of the details that it can expose about your server.
To configure a custom error page for ASP.NET 3.5 SP1 and later, follow this example:
<configuration> <system.web> <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/error.aspx" /> </system.web> </configuration>
The following example is for ASP.NET 2.0 to 3.5 without SP1:
<configuration> <system.web> <customErrors mode="On" defaultRedirect="~/error.html" /> </system.web> </configuration>
For more information about security, see the following ASP.NET security references:
Continue the conversation in the Rackspace Community.
©2016 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License