2013-12-09 53 views
2

我有一個全新安裝的Windows Server 2008與IIS7。我安裝了「Classic ASP」,並將調試選項「將錯誤發送到瀏覽器」更改爲True。經典ASP - 自定義錯誤頁面

我創建一個目錄,2個文件:

-- C:\inetpub\wwwroot\stadtbibliothek 
- index.asp -> <% Response.Write "Hello World" %> 
- 500-100.asp -> <% Response.Write "Error" %> 

我konverted目錄中的應用程序併爲其分配一個應用程序池,我創建(.NET版本:無託管代碼, pipelinecode:classic)。

然後我測試了遠程客戶端的頁面(http://svr-name.domain/stadtbibliothek/)和「Hello World」出現。

2.

我添加一個錯誤給的index.asp文件和一個web.config文件以 「stadtbibliothek」 文件夾(有沒有在根):

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <defaultDocument> 
      <files> 
       <add value="index.asp" /> 
      </files> 
     </defaultDocument> 
       <httpErrors> 
        <remove statusCode="500" subStatusCode="100" /> 
        <error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" /> 
       </httpErrors> 
    </system.webServer> 
</configuration> 

解決方案:

原來我只是需要包括文件夾名,路徑:

<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" />

感謝您的建議!

回答

1

documentation

路徑:必需的字符串屬性。

指定爲響應由statusCode和subStatusCode屬性指定的HTTP 錯誤而提供的文件路徑或URL。如果您選擇文件響應模式 ,則可以指定自定義錯誤頁面的路徑 。如果選擇ExecuteURL響應模式,則的路徑具有 爲服務器相對URL(例如,/404.htm)。如果您選擇 重定向響應模式,則必須輸入絕對URL(例如, 示例,www.contoso.com/404.htm)。

嘗試修改此行:

<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" /> 

要這樣:

<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" /> 
0

我想你應該在的customErrors:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    * 
    * 
    * 
    </system.webServer> 
    <system.web> 
    <customErrors mode="On"/> 
    </system.web> 
</configuration>