I am trying to setup custom error pages for my site (ASP.NET 4, integrated pipeline).
Everything works properly on local machine but custom error pages for .aspx pages do not get shown on shared hosting (I see default error pages).
If I change redirectMode="ResponseRewrite" to redirectMode="ResponseRedirect" everything works properly on local and shared machine.
error.aspx is a real file that resides next to web.config file (in the root of the site). Site has no Global.asax file.
Local machine runs IIS 7.5, I do not use routing (at least consciously) and shared hosting tells that Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319
Could you please tell me what might be the reason for such different behavior and what should I do to resolve the issue.
Here is excerpt from my web.config file:
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" />
<error statusCode="404" path="/error.aspx" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
<system.web>
<customErrors mode="On" defaultRedirect="error.aspx" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="~/error.aspx"/>
</customErrors>
<httpRuntime requestValidationMode="2.0" />
</system.web>