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)

适用于