CustomErrorCollection.Get Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the specified CustomError.
Get(String) |
Gets the CustomError object with the specified status code. |
Get(Int32) |
Gets the CustomError object with the specified index. |
Gets the CustomError object with the specified status code.
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
Parameters
- statusCode
- String
The HTTP status code associated with the custom error.
Returns
The CustomError object with the specified status code.
Examples
The following code example shows how to get a CustomError object with the specified status code.
Refer to the code example in the CustomErrorCollection class topic to learn how to get the collection.
// Get the error with status code 404.
CustomError customError1 =
customErrorsCollection["404"];
' Get the error with status code 404.
Dim customError1 As CustomError = _
customErrorsCollection("404")
Applies to
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Gets the CustomError object with the specified index.
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
Parameters
- index
- Int32
The collection index of the CustomError object.
Returns
The CustomError with the specified index.
Examples
The following code example shows how to get a CustomError object at the specified collection index.
Refer to the code example in the CustomErrorCollection class topic to learn how to get the collection.
// Get the error with collection index 0.
CustomError customError =
customErrorsCollection[0];
' Get the error with collection index 0.
Dim customError As CustomError = _
customErrorsCollection(0)
Applies to
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: