CustomError.StatusCode Property

 

Gets or sets the HTTP error status code.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

<ConfigurationPropertyAttribute("statusCode", IsRequired := True,
	IsKey := True)>
<IntegerValidatorAttribute(MinValue := 100, MaxValue := 999)>
Public Property StatusCode As Integer

Property Value

Type: System.Int32

The HTTP error status code that causes the redirection to the custom error page.

The HTTP status code is used by the ASP.NET infrastructure to redirect the application to the error page when a specific error occurs.

System_CAPS_noteNote

The custom error is issued only if it is caused by an entity handled by ASP.NET; otherwise, a standard error is issued.

The following code example shows how to use the status code. Refer to the code example in the CustomError class topic to learn how to get the collection.

' Get second error StatusCode.
  Dim currentError1 As CustomError = _
  customErrorsCollection(1)
  Dim currentStatusCode As Integer = _
  currentError1.StatusCode

' Set the second error StatusCode.
  currentError1.StatusCode = 404

.NET Framework
Available since 2.0
Return to top
Show: