【发布时间】:2011-04-26 18:44:59
【问题描述】:
我正在尝试处理我的网络应用程序中的 403 和 404 错误。我已阅读MS instructions 并在我的服务器上应用。 IIS7 管理器通过将我的 web.config 编辑为:
<httpRedirect enabled="false" destination="/MySite" httpResponseStatus="Temporary" />
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<error statusCode="403" prefixLanguageFilePath="" path="/mySite/Error.aspx" responseMode="ExecuteURL" />
<error statusCode="404" prefixLanguageFilePath="" path="/mySite/Error.aspx" responseMode="ExecuteURL" />
</httpErrors>
它确实可以处理http://www.mysite/fictiousURL.aspx 之类的请求,但不适用于http://www.mysite/fictiousURLTest.html。好像只能处理aspx请求。
我也试过http://www.15seconds.com/issue/030102.htm,在system.web节点中添加这个配置<customErrors mode="On" defaultRedirect="/mysite/error.aspx" />。
任何人都知道 a) 为什么 IIS7 只处理 aspx 和 b) 任何人都知道如何处理像 http://www.mysite/fictiousURLTest.html 这样的通用请求?
谢谢,比尔 N
【问题讨论】:
标签: iis-7 custom-errors