2011-04-26 72 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>