CustomError.StatusCode Property
Definition
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 or sets the HTTP error status code.
public:
property int StatusCode { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("statusCode", IsKey=true, IsRequired=true)]
[System.Configuration.IntegerValidator(MaxValue=999, MinValue=100)]
public int StatusCode { get; set; }
[<System.Configuration.ConfigurationProperty("statusCode", IsKey=true, IsRequired=true)>]
[<System.Configuration.IntegerValidator(MaxValue=999, MinValue=100)>]
member this.StatusCode : int with get, set
Public Property StatusCode As Integer
Property Value
The HTTP error status code that causes the redirection to the custom error page.
- Attributes
Examples
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.
CustomError currentError1 =
customErrorsCollection[1];
int currentStatusCode =
currentError1.StatusCode;
// Set the second error StatusCode.
currentError1.StatusCode = 404;
' Get second error StatusCode.
Dim currentError1 As CustomError = _
customErrorsCollection(1)
Dim currentStatusCode As Integer = _
currentError1.StatusCode
' Set the second error StatusCode.
currentError1.StatusCode = 404
Remarks
The HTTP status code is used by the ASP.NET infrastructure to redirect the application to the error page when a specific error occurs.
Note
The custom error is issued only if it is caused by an entity handled by ASP.NET; otherwise, a standard error is issued.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기