我正在尝试在我的网络应用中处理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请求.
我还尝试通过添加此配置< customErrors mode =“On”defaultRedirect =“/ mysite / error.aspx”/>来尝试http://www.15seconds.com/issue/030102.htm.在system.web节点中.
任何人都知道a)为什么IIS7只处理aspx和b)任何人都知道如何处理像http://www.mysite/fictiousURLTest.html这样的通用请求?
比尔,N,谢谢
最佳答案 请参阅此处给出的回复:
IIS7 and HTTP status code handling
看起来你可能需要设置
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>