CustomError.StatusCode Propriedade
Definição
Obtém ou define o código de status de erro HTTP.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
Valor da propriedade
O código de status de erro HTTP que causa o redirecionamento para a página de erro personalizada.The HTTP error status code that causes the redirection to the custom error page.
- Atributos
Exemplos
O exemplo de código a seguir mostra como usar o código de status.The following code example shows how to use the status code. Consulte o exemplo de código no CustomError tópico de classe para saber como obter a coleção.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
Comentários
O código de status HTTP é usado pela infraestrutura ASP.NET para redirecionar o aplicativo para a página de erro quando ocorre um erro específico.The HTTP status code is used by the ASP.NET infrastructure to redirect the application to the error page when a specific error occurs.
Observação
O erro personalizado será emitido somente se for causado por uma entidade manipulada por ASP.NET; caso contrário, um erro padrão será emitido.The custom error is issued only if it is caused by an entity handled by ASP.NET; otherwise, a standard error is issued.