Pau*_*rge 6 asp.net-mvc web-config http-status-code-404 asp.net-mvc-3
我正在使用[HandleError]MVC3 应用程序中的属性处理错误。这工作正常,但要使其正常工作,我需要添加
<system.web>
<customErrors mode="On" />
Run Code Online (Sandbox Code Playgroud)
为了处理 404 错误,我将其添加到系统中。网络服务器即 IIS 配置而不是 asp.net
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/404page" />
</httpErrors>
Run Code Online (Sandbox Code Playgroud)
这很简单并且非常适合 404。在这里添加它的原因是它似乎是一个很好的包罗万象的,没有任何自定义代码。existingResponse= "Replace"是必需的,其他模式会导致 404 不被处理。
问题是当 existingResponse="Replace" 时 CustomErrors 不再起作用。它只返回一个没有详细信息的剥离 500 错误。
这两种模式只是相互排斥吗?我知道我可以编写其他 404 解决方案,但理想情况下我希望这个简单的配置更改起作用或理解为什么它无法完成。
| 归档时间: |
|
| 查看次数: |
9132 次 |
| 最近记录: |