.net 4.0 本机调试时一切正常,配置如下
<customErrors redirectMode="ResponseRewrite" mode="On" defaultRedirect="~/PageStatus/Page_404.aspx">
<error statusCode="404" redirect="~/PageStatus/Page_404.aspx" /></customErrors>
传到服务器上却不生效了,服务器配置为windows2008 server R2 IIS7.5
搜来搜去,咱家的东西全是转贴来的啊,也说用system.webserver可以解决,但我怎么改也不管用啊,后来在国外找到一篇文章,成功解决,供同样郁闷的同学借鉴
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode='-1' />
<error statusCode="404" path="/PageStatus/Page_404.aspx" prefixLanguageFilePath="" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>