語言

CustomErrorCollection.Get 方法

定義

得到指定的 CustomError。

多載

名稱 Description
Get(String)

取得 CustomError 具有指定狀態碼的物件。

Get(Int32)

取得 CustomError 具有指定索引的物件。

Get(String)

取得 CustomError 具有指定狀態碼的物件。

public:
 System::Web::Configuration::CustomError ^ Get(System::String ^ statusCode);
public System.Web.Configuration.CustomError Get(string statusCode);
member this.Get : string -> System.Web.Configuration.CustomError
Public Function Get (statusCode As String) As CustomError

參數

statusCode
String

與自訂錯誤相關聯的 HTTP 狀態碼。

傳回

帶有指定狀態碼的 CustomError 物件。

範例

以下程式碼範例說明如何取得 CustomError 指定狀態碼的物件。

參考課堂主題中的 CustomErrorCollection 程式碼範例,學習如何取得該集合。

// Get the error with status code 404.
CustomError customError1 = 
    customErrorsCollection["404"];
' Get the error with status code 404.
  Dim customError1 As CustomError = _
  customErrorsCollection("404")

適用於

Get(Int32)

取得 CustomError 具有指定索引的物件。

public:
 System::Web::Configuration::CustomError ^ Get(int index);
public System.Web.Configuration.CustomError Get(int index);
member this.Get : int -> System.Web.Configuration.CustomError
Public Function Get (index As Integer) As CustomError

參數

index
Int32

物件的 CustomError 集合索引。

傳回

該 CustomError 索引為指定。

範例

以下程式碼範例說明如何在指定的集合索引取得 CustomError 物件。

參考課堂主題中的 CustomErrorCollection 程式碼範例,學習如何取得該集合。

// Get the error with collection index 0.
CustomError customError = 
    customErrorsCollection[0];
' Get the error with collection index 0.
  Dim customError As CustomError = _
  customErrorsCollection(0)

適用於