次の方法で共有


ServicePointManager.Expect100Continue プロパティ

メモ : この名前空間、クラス、およびメンバは、.NET Framework Version 1.1 だけでサポートされています。

100-Continue 動作を使用するかどうかを決定する Boolean 値を取得または設定します。

Public Shared Property Expect100Continue As Boolean
[C#]
public static bool Expect100Continue {get; set;}
[C++]
public: __property static bool get_Expect100Continue();public: __property static void set_Expect100Continue(bool);
[JScript]
public static function get Expect100Continue() : Boolean;public static function set Expect100Continue(Boolean);

プロパティ値

POST 要求に対して 100-Continue の応答を期待する場合は true 。それ以外の場合は false 。既定値は true です。

解説

このプロパティを true に設定した場合、POST メソッドを使用するクライアント要求は、サーバーから 100-Continue 応答が送信されるまで待機し、ポストするデータの送信はその応答の後に行われます。これにより、サーバーが要求のヘッダーに基づいて要求を拒否する場合に、大量のデータがクライアントからネットワークを通じて無駄に送信されることを避けることができます。たとえば、 System.Net.Sockets.ServicePointManager.Expect100Continue プロパティを false にしたとします。その場合、サーバーに要求が送信される際には、データも一緒に送信されます。要求のヘッダーが読み取られた後、サーバーが認証を要求し、401 応答を送信した場合、クライアントは適切な認証ヘッダーを付けてデータを再送信する必要があります。一方、このプロパティが true である場合は、まず要求ヘッダーだけがサーバーに送信されます。サーバーが要求を拒否しなければ、100-Continue 応答によってデータの送信が許可されます。サーバーによって認証が要求され、401 応答が返された場合でも、その時点ではデータはまだクライアントから送信されていないので、無駄な通信は発生しません。

このプロパティの値を変更しても、既存のサービス ポイントには影響しません。変更後に作成された新しいサービス ポイントだけに影響します。

Expect 100-Continue 機能の詳細については、IETF RFC 2616 Section 10.1.1 を参照してください。

使用例

[Visual Basic, C#, C++] このプロパティを設定する例を次に示します。

 
ServicePointManager.UseNagleAlgorithm = True
ServicePointManager.Expect100Continue = True
ServicePointManager.CheckCertificateRevocationList = True
ServicePointManager.DefaultConnectionLimit = _
    ServicePointManager.DefaultPersistentConnectionLimit

[C#] 
ServicePointManager.UseNagleAlgorithm = true;
ServicePointManager.Expect100Continue = true;
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit;

[C++] 
ServicePointManager::UseNagleAlgorithm = true;
ServicePointManager::Expect100Continue = true;
ServicePointManager::CheckCertificateRevocationList = true;
ServicePointManager::DefaultConnectionLimit = ServicePointManager::DefaultPersistentConnectionLimit;

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ServicePointManager クラス | ServicePointManager メンバ | System.Net 名前空間