次の方法で共有


HttpResponse.StatusCode プロパティ

クライアントへ返される出力の HTTP ステータス コードを取得または設定します。

Public Property StatusCode As Integer
[C#]
public int StatusCode {get; set;}
[C++]
public: __property int get_StatusCode();public: __property void set_StatusCode(int);
[JScript]
public function get StatusCode() : int;public function set StatusCode(int);

プロパティ値

クライアントへ返される HTTP 出力のステータスを表す整数。既定値は 200 (OK) です。

例外

例外の種類 条件
HttpException HTTP ヘッダーが送信された後に、 StatusCode が設定されています。

使用例

ステータス コードが 200 以外の場合にアクションを実行する例を次に示します。

 
If Response.StatusCode <> 200 Then
    '...
 End If
    

[C#] 
if (Response.StatusCode != 200) 
 {
   // ...
 }
    

[C++] 
if (Response->StatusCode != 200) 
 {
   // ...
 }
    

[JScript] 
if(Response.StatusCode != 200){
  //...
}

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

参照

HttpResponse クラス | HttpResponse メンバ | System.Web 名前空間