In the past, I am used to using the customErrors element in the web.config to specify when to use a custom error page to hide detailed exception information from users.
From what I see now, it is preferred to use the httpErrors . I have referenced several different resources including the IIS documentation how to accomplish what I need, but I can't seem to figure it out. The requirements I need to specify in the web.config is the following:
1) If HTTP 404 Error a) If Local, just return IIS 404 or Yellow Screen of Death (YSOD) or whatever. (It doesn't really matter) b) If not local, execute URL /Path/To/My/404/ErrorMVCAction 2) If ANY OTHER HTTP ERROR a) Use static error.htm page. Currently, we have the following:
<httpErrors errorMode="DetailedLocalOnly" existingResponse="Replace"> <remove statusCode="404" /> <error statusCode="404" prefixLanguageFilePath="" path="/Path/To/My/404/ErrorMVCAction" responseMode="ExecuteURL" /> </httpErrors> When I navigate to a page that doesn't exist and get a 404, I get my custom error page (I tested this by changing the errorMode to 'Custom'. However, when a 500 occurs, instead of getting the Yellow Screen of Death where I can see a stack trace locally, I get the Blue IIS Error Summary page. An example of this is shown below.
