I am trying to customize my own error pages for my site (ASP.NET 4, integrated pipeline).
Everything works correctly on the local computer, but custom error pages for .aspx
pages do not appear on shared hosting (I see error pages by default).
If I change redirectMode="ResponseRewrite"
to redirectMode="ResponseRedirect"
, everything works correctly on the local and shared machine.
error.aspx
is the real file, which is located next to the web.config
(in the root directory of the site). The site does not have a Global.asax
file.
The local computer runs IIS 7.5, I do not use routing (at least consciously), and shared hosting reports that Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319
Could you tell me what could be causing such different behaviors and what I must do to solve the problem.
Here is an excerpt from my web.config
:
<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>
source share