共用方式為


CustomErrorsSection.DefaultRedirect 屬性

定義

取得或設定預設的重定向網址。

public:
 property System::String ^ DefaultRedirect { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("defaultRedirect")]
public string DefaultRedirect { get; set; }
[<System.Configuration.ConfigurationProperty("defaultRedirect")>]
member this.DefaultRedirect : string with get, set
Public Property DefaultRedirect As String

屬性值

當應用程式發生錯誤時,會被重新導向的預設網址。

屬性

例外狀況

IsEditable 屬性為 true。 此為預設值。

範例

以下程式碼範例說明如何使用該 DefaultRedirect 屬性。

參考課堂主題中的 CustomErrorsSection 程式碼範例,了解如何取得該章節。

// Get the currentDefaultRedirect
string currentDefaultRedirect = 
    customErrorsSection.DefaultRedirect;
' Get the currentDefaultRedirect
  Dim currentDefaultRedirect As String = _
  customErrorsSection.DefaultRedirect

備註

若未指定, DefaultRedirect 則顯示標準誤。 它 DefaultRedirect 指定了若沒有錯誤自訂頁面時啟用的通用錯誤頁面。

備註

網址可能是絕對值或相對值。 相對 URL 是相對於指定 的 DefaultRedirectWeb.config 檔案,而非錯誤發生的網頁。 以波浪點(~)開頭的相對 URL 是相對於應用程式根路徑的。

適用於