CustomErrorCollection.Get 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指定的 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)