クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
以前のバージョン
.NET Framework SDK 2.0
System.Web
HttpResponse クラス
HttpResponse プロパティ
 StatusCode プロパティ

  低帯域幅での表示をオンにする
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2005/.NET Framework 2.0

その他のバージョンについては、以下の情報を参照してください。
HttpResponse.StatusCode プロパティ
クライアントへ返される出力の HTTP ステータス コードを取得または設定します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)

Visual Basic (宣言)
Public Property StatusCode As Integer
Visual Basic (使用法)
Dim instance As HttpResponse
Dim value As Integer

value = instance.StatusCode

instance.StatusCode = value
C#
public int StatusCode { get; set; }
C++
public:
property int StatusCode {
	int get ();
	void set (int value);
}
J#
/** @property */
public int get_StatusCode ()

/** @property */
public void set_StatusCode (int value)
JScript
public function get StatusCode () : int

public function set StatusCode (value : int)
XAML
適用できません。

プロパティ値

クライアントへ返される HTTP 出力のステータスを表す整数。既定値は 200 (OK) です。有効なステータス コードの一覧については、「Http 状態コード」を参照してください。
例外の種類条件

HttpException

HTTP ヘッダーが送信された後に、StatusCode が設定されています。

次のコード例では、出力ストリームのステータス コードを確認します。ステータス コードが 200 と等しくない場合は、追加のコードが実行されます。

Visual Basic
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    ' Show success or failure of page load.
    If Response.StatusCode <> 200 Then
        Response.Write("There was a problem accessing the web resource." & _
            "<br />" & Response.StatusDescription)
    End If

End Sub
C#
protected void Page_Load(object sender, EventArgs e)
{
    // Show success or failure of page load.
    if (Response.StatusCode != 200)
    {
        Response.Write("There was a problem accessing the web resource" +
            "<br />" + Response.StatusDescription);
    }
}

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件  |  商標  |  プライバシー
Page view tracker