IIS7 custom 404 not showing
answer was to use
<httpErrors existingResponse="Replace" errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/pages/404.aspx?he" responseMode="ExecuteURL" />
</httpErrors>
and not to have any system.web customErrors
this worked for both .aspx and non .aspx requests.
bizarrely this combination did not come up in any of the blog posts and stackoverflow answers I had investigated, it was just luck I tried it.
<httpErrors existingResponse="PassThrough" />
worked for me in IIS 7 (Windows Server 2008 R2).
My problem was I had this in my web.config, but in a <location>
. Moving it to the root <system.webServer>
fixed it.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
...
<system.webServer>
...
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>