Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
So I'm currently trying to get my custom errors to work but when doing so I get the following error:
Server Error in '/' Application.
Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
In the event viewer, the only exception happening is the standard database connection error exception but I need to show a custom error page when this happens (even if it's a static html page without using a controller).
This is the custom errors tag in web.config under < system.web >
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/Error">
<error statusCode="400" redirect="~/Error" />
<error statusCode="404" redirect="~/Error/NotFound" />
<error statusCode="500" redirect="~/Error" />
public class ErrorController : Controller
public ViewResult Index()
public ViewResult NotFound()
I have this under <system.webServer> where the key part I believe is existingResponse="Replace"
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="404" path="/404" responseMode="ExecuteURL" />
<error statusCode="500" path="/500error.html" responseMode="File" />
I had used the httpErrors object under system.webServer previously, the responseMode="File" was the only difference which has successfully redirected it to my HTML file, however, that then gives me the following message "The page cannot be displayed because an internal server error has occurred.".
I am just using a default HTML template as the page, so nothing that could be causing a further error, so I believe the database not connecting is preventing the static error page from displaying:
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted