【发布时间】:2013-01-22 12:07:44
【问题描述】:
我有 asp.net Web 应用程序并尝试为 Dynamic Ip Restrictions module 指定自定义 HTML,它在 .net 代码之前返回 401。
我在 web.config 中添加了以下内容:
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" path="ddos.html" responseMode="File" />
<error statusCode="401" subStatusCode="502" path="ddos.html" responseMode="File" />
<error statusCode="404" prefixLanguageFilePath="" path="/404" responseMode="ExecuteURL" />
</httpErrors>
Productin 环境(Windows Server 2008):带有 404 和 401 的页面工作正常,但异常处理被破坏 - 我看到内置 iis“红色”页面而不是自定义页面。
开发环境(windows 7/8):404和错误都可以,但是401会将用户重定向到登录页面。
异常处理定义为:
[HandleError(View = "Error", Master = "~/Views/Shared/_ThreeColumnsLayout.cshtml")]
UPD1:另外,我可以补充一点,如果我删除代码为 500 的页面,我会看到以下纯文本消息:
The page cannot be displayed because an internal server error has occurred.
【问题讨论】:
标签: asp.net-mvc iis web-config handleerror ip-restrictions