I have the following customErrors section in my ASP.NET application:
<customErrors mode="RemoteOnly">
<error statusCode="500" redirect="500.aspx"/>
</customErrors>
How do I show user-friendly message, if “500.aspx” gives an error (it could happen when the database is down, for example)?
You can use a static page (e.g. 500.html) to avoid this problem.
In response co comment:
The only sure way to know if 500.aspx is going to work is to try it. So in this case, you could define 500.aspx in the
customErrorselement of web.config, and handle the specific case of 500.aspx in global.asax, e.g. :