在我的 web.config 文件中使用以下配置,
<customErrors mode="On" redirectMode="ResponseRedirect" >
<error statusCode="404" redirect="/404" />
</customErrors>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404" responseMode="ExecuteURL" />
</httpErrors>
404 页面效果很好,但是对于以 .aspx 结尾的 url,会发生重定向,并且会删除该 url 的查询字符串。如果我将标记“customErrors”中的参数“redirectMode”更改为“ResponseRewrite”,它将停止对 .aspx url 工作,我只会得到默认的 ASP.NET 错误页面。我怎样才能解决这个问题?我需要 404 页面上的查询字符串才能将用户重定向到正确的新 url。
/维克托