<error> 項目
定義關聯 HTTP 狀態碼的自訂錯誤重新導向。
<configuration>
<system.web>
<customErrors>
<error>
<error statusCode="statuscode"
redirect="url"/>
選擇性屬性
屬性 | 說明 |
---|---|
StatusCode | 指定將導致重新導向錯誤網頁的 HTTP 狀態碼。 |
Redirect | 將相關錯誤資訊呈現給用戶端的錯誤網頁。 |
範例
下列範例指定用於 ASP.NET 應用程式的錯誤處理網頁。
<configuration>
<system.web>
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly">
<error statusCode="500"
redirect="InternalError.htm"/>
</customErrors>
</system.web>
</configuration>
需求
包含於:<system.web>
**Web 平台:**IIS 5.0、IIS 5.1、IIS 6.0
**組態檔:**Machine.config, Web.config
**組態區段處理常式:**System.Web.Configuration.CustomErrorsConfigHandler