I have asp.net web application and try to specify custom HTML for Dynamic Ip Restrictions module, which returns 401 prior to .net code.
I've added following to my web.config:
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" path="ddos.html" responseMode="File" />
<error statusCode="401" subStatusCode="502" path="ddos.html" responseMode="File" />
<error statusCode="404" prefixLanguageFilePath="" path="/404" responseMode="ExecuteURL" />
</httpErrors>
Productin environment (windows Server 2008): Pages with 404 and 401 works fine, but exception handling is broken - i see built-in iis "red" page instead of custom page.
Development environment (windows 7/8): 404 and erors are fine, but 401 redirect user to login page.
Exception handling defined as:
[HandleError(View = "Error", Master = "~/Views/Shared/_ThreeColumnsLayout.cshtml")]
UPD1: Also, I can add that if I remove pages with code 500, I see foloowing plain text message:
The page cannot be displayed because an internal server error has occurred.
does the trick