2011-04-26 76 views
4

我正试图在我的web应用程序中处理403和404错误。我已阅读MS instructions并应用到我的服务器上。IIS 7中的自定义HTTP错误

<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工作:IIS7经理有效地通过编辑我的web.config作为处理这个问题。它似乎只能够处理aspx请求。

我也试过http://www.15seconds.com/issue/030102.htm在system.web节点中加入这个配置<customErrors mode="On" defaultRedirect="/mysite/error.aspx" />

任何人都知道)为什么IIS7只处理ASPX和b)任何人都知道如何处理通用requsts像http://www.mysite/fictiousURLTest.html

谢谢你,比尔ñ

回答

2

看到我的响应这里给出:IIS7 and HTTP status code handling

看起来你可能需要设置

<system.webServer> 
    <httpErrors existingResponse="PassThrough" /> 
    </system.webServer>