【发布时间】:2014-02-10 00:59:32
【问题描述】:
“MVC 5 路由”能否在 web.config 的 system.webServer httpErrors 部分的 error 元素中用作 path?
<configuration>
...other config stuff...
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404"/>
<error statusCode="404" path="/Error/NotFound" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
</configuration>
【问题讨论】:
-
是的,responseMode 设置对于确保在错误条件下启动正确的路由很重要。您看到了什么结果?
-
那么 ExecuteURL 不仅适用于 .aspx 页面吗? MSDN/IIS 文档对此不是很清楚。 ExecuteURL 提供在路径属性中为自定义错误指定的动态内容(例如,.asp 文件)。如果 responseMode 设置为 ExecuteURL,则路径值必须是服务器相对 URL。数值为 1
标签: asp.net-mvc iis routes asp.net-mvc-5