ServicePointManager.Expect100Continue プロパティ

定義

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

public:
 static property bool Expect100Continue { bool get(); void set(bool value); };
public static bool Expect100Continue { get; set; }
static member Expect100Continue : bool with get, set
Public Shared Property Expect100Continue As Boolean

プロパティ値

100-Continue 動作を有効にする場合は true。 既定値は true です。

次のコード例では、このプロパティを設定します。

ServicePointManager::UseNagleAlgorithm = true;
ServicePointManager::Expect100Continue = true;
ServicePointManager::CheckCertificateRevocationList = true;
ServicePointManager::DefaultConnectionLimit = ServicePointManager::DefaultPersistentConnectionLimit;
ServicePointManager.UseNagleAlgorithm = true;
ServicePointManager.Expect100Continue = true;
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit;
ServicePointManager.UseNagleAlgorithm = True
ServicePointManager.Expect100Continue = True
ServicePointManager.CheckCertificateRevocationList = True
ServicePointManager.DefaultConnectionLimit = _
    ServicePointManager.DefaultPersistentConnectionLimit

注釈

このプロパティを に true設定すると、100-Continue 動作が使用されます。 および POST メソッドを使用PUTするクライアント要求では、 プロパティが であり、 プロパティが ContentLengthtrue 0 より大きい場合、または プロパティが true の場合Expect100Continue、要求に Expect ヘッダーがSendChunked追加されます。 クライアントは、クライアントが投稿するデータを送信する必要があることを示すために、サーバーから 100-Continue 応答を受け取る必要があります。 このメカニズムにより、クライアントは、サーバーが要求ヘッダーに基づいて要求を拒否する場合に、ネットワーク経由で大量のデータを送信することを回避できます。

たとえば、 プロパティが Expect100Continue であると falseします。 要求がサーバーに送信されると、データが含まれます。 要求ヘッダーを読み取った後、サーバーが認証を必要とし、401 応答を送信する必要がある場合、クライアントは適切な認証ヘッダーを使用してデータを再送信する必要があります。

このプロパティが の場合、 true要求ヘッダーはサーバーに送信されます。 サーバーが要求を拒否していない場合は、データを送信できることを通知する 100-Continue 応答を送信します。 前の例のように、サーバーが認証を必要とする場合は、401 応答を送信し、クライアントがデータを不必要に送信していません。

このプロパティの値を変更しても、既存 ServicePoint のオブジェクトには影響しません。 変更後に作成された新しい ServicePoint オブジェクトのみが影響を受けます。

このプロパティが に true設定されている場合でも、HTTP 1.0 要求では 100-Continue 動作は使用されません。

Expect 100-Continue 動作については、IETF RFC 2616 セクション 10.1.1 で完全に説明されています。

適用対象

こちらもご覧ください