Share via


CustomErrorCollection.Get 方法

定義

取得指定的 CustomError

多載

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)

適用於