I’ve got following in my web.config:
<compilation defaultLanguage="vb" debug="false" targetFramework="4.0"/>
<customErrors mode="On" defaultRedirect="~/error.html"/>
It works fine, displaying my custom error page, for a standard error (such as a crash/request of page that does not exist). However, it fails on the following specific request and exposes debug info:
https://mywebsite/Page.aspx?error=<iframe>
How do I capture ALL cases, including these?
Error page returned is:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
BTW, if you are using IIS 7
Consider following things:
1.)
<httpErrors>:<httpErrors>configures error pages in IIS itself, outside the web application. This handles all requests, whether they’re in fact handled by ASP.NET or IIS natively.Eg.:
2.) Use HttpResponse.TrySkipIisCustomErrors Property to gets or sets a value that specifies whether IIS 7.0 custom errors are disabled.
The TrySkipIisCustomErrors property is used only when your application is hosted in IIS 7.0. When running in Classic mode in IIS 7.0 the TrySkipIisCustomErrors property default value is true. When running in Integrated mode, the TrySkipIisCustomErrors property default value is false.