Share via


CustomError.StatusCode プロパティ

定義

HTTP エラー ステータス コードを取得または設定します。

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

プロパティ値

カスタム エラー ページへのリダイレクトの原因となる HTTP エラー ステータス コード。

属性

次のコード例は、状態コードの使用方法を示しています。 コレクションを取得する方法については、クラス トピックの CustomError コード例を参照してください。

// 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

注釈

HTTP 状態コードは、特定のエラーが発生したときにアプリケーションをエラー ページにリダイレクトするために、ASP.NET インフラストラクチャによって使用されます。

Note

カスタム エラーは、ASP.NET によって処理されたエンティティによって発生した場合にのみ発行されます。それ以外の場合は、標準エラーが発行されます。

適用対象