I want to debug the controller that handles all HTTP errors in the site. There is the following in the web.config
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
<remove statusCode="500" />
<error statusCode="500" responseMode="ExecuteURL" path="/Error/ServerError" />
</httpErrors>
But when I deliberately throw an exception
throw new HttpException(500, "error, I cant be bothered");
The controller for Error/ServerError
is not hit and I get the standard yellow detailed error page.
The documentation states
If you set the errorMode value to Custom, IIS returns only custom error messages to all requesting browsers.
Which should mean local errors are handled by the custom pages.
What other settings affect the display of detailed error message? What can I change to get the custom error page to display locally?
Thanks