CustomErrorsSection.DefaultRedirect 屬性

定義

取得或設定重新導向的預設 URL。

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

屬性值

String

應用程式在錯誤發生時重新導向到的預設 URL。

屬性

例外狀況

DefaultRedirect 屬性為 null。 此為預設值。

範例

下列程式碼範例示範如何使用 DefaultRedirect 屬性。

請參閱類別主題中的 CustomErrorsSection 程式碼範例,以瞭解如何取得區段。

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

備註

DefaultRedirect如果未指定 ,則會改為顯示標準錯誤。 DefaultRedirect指定要啟動的一般錯誤頁面,以防沒有任何錯誤自訂頁面存在。

注意

URL 可能是絕對值或相對值。 相對 URL 相對於指定 DefaultRedirect 的 Web.config 檔案,而不是發生錯誤的網頁。 從磚 (~ 開始的相對 URL,) 相對於應用程式的根路徑。

適用於