2013-09-30 28 views
1

我面臨着我的一個服務器的問題,我設置了自定義錯誤頁面,但是當我在URL中有文件擴展名時,錯誤頁面沒有顯示它不適用於somedomain.com/abcd.aspx或somedomain.com/abcd.aspx,它只是顯示空白頁面。IIS 7.5自定義錯誤頁面不能用於擴展名文件

這是工作,如果我沒有文件擴展名在我的網址爲例如http://somedomain.com/abcd工作正常。

以下是配置在web.config文件

<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" existingResponse="Replace"> 
     <remove statusCode="502" subStatusCode="-1" /> 
     <remove statusCode="501" subStatusCode="-1" /> 
     <remove statusCode="500" subStatusCode="-1" /> 
     <remove statusCode="412" subStatusCode="-1" /> 
     <remove statusCode="406" subStatusCode="-1" /> 
     <remove statusCode="405" subStatusCode="-1" /> 
     <remove statusCode="404" subStatusCode="-1" /> 
     <remove statusCode="403" subStatusCode="-1" /> 
     <remove statusCode="401" subStatusCode="-1" /> 
     <error statusCode="401" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="403" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="404" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="405" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="406" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="412" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="500" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="501" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="502" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" /> 
    </httpErrors> 

任何幫助或指針的設置將是巨大的。

問候, 薩米爾

回答

1

我敢肯定你已經解決了這個現在,但對於其他人尋找答案,我今天碰見同樣的問題,並能夠通過添加customError來解決這個問題處理程序除了httpErrors之外。

變化:

<system.web> 
    <customErrors mode="Off" /> 

到:

<system.web> 
    <customErrors mode="RemoteOnly"> 
     <error redirect="/Errors/404" statusCode="404" /> 
    </customErrors>