I'm currently working on deploying a asp.net website to a shared hosted environment, and this works as expected (404 pages render)
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/file-not-found.htm" responseMode="ExecuteURL" />
</httpErrors>
but this doesn't (500 internal server error)
<httpErrors errorMode="Custom" defaultPath="error.htm" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/file-not-found.htm" responseMode="ExecuteURL" />
</httpErrors>
I asked to take a look at the applicationHost.config and it has:
<httpErrors errorMode="Custom" defaultPath="C:\inetpub\custerr\en-US\SSLRedirect.htm" lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
So I'm assuming that the defaultPath as a locked attribute is the thing that's causing issues.
Because this is being deployed to a shared environment, the hosting company is not willing to modify the applicationHost.config to remove the lock on defaultPath - so is there any way to specify a default error page without unlocking the defaultPath attribute?