HttpWebRequest.AllowWriteStreamBuffering プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpWebRequest.AllowWriteStreamBuffering プロパティの意味・解説 

HttpWebRequest.AllowWriteStreamBuffering プロパティ

インターネット リソース送信するデータバッファリングするかどうかを示す値を取得または設定します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

Public Property AllowWriteStreamBuffering As
 Boolean
Dim instance As HttpWebRequest
Dim value As Boolean

value = instance.AllowWriteStreamBuffering

instance.AllowWriteStreamBuffering = value
public bool AllowWriteStreamBuffering { get;
 set; }
public:
property bool AllowWriteStreamBuffering {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_AllowWriteStreamBuffering ()

/** @property */
public void set_AllowWriteStreamBuffering (boolean
 value)
public function get AllowWriteStreamBuffering
 () : boolean

public function set AllowWriteStreamBuffering
 (value : boolean)

プロパティ
インターネット リソース送信するデータバッファリング有効にする場合trueバッファリング無効にする場合false既定値true です。

解説解説

AllowWriteStreamBufferingtrue場合データメモリバッファリングされるため、リダイレクト要求または認証要求発生したときにすぐに再送信できます

実装時の注意 AllowWriteStreamBufferingtrue設定すると、大きなデータセットアップロードするときに、パフォーマンス上の問題生じることがあります。これは、データ バッファが、利用できるメモリをすべて使用してしまう可能性があるためです。

Windows Mobile for Pocket PCWindows Mobile for SmartphoneWindows CE プラットフォームメモ : パフォーマンス上の理由から、このプロパティ既定値false です。ただし、動詞POST などのエンティティ データ必要な場合は、リダイレクト認証が行われない場合があることに注意してくださいHTTP 要求対す.NET Framework機能を完全に実装するには、AllowWriteStreamBufferingtrue設定します

使用例使用例

AllowWriteStreamBuffering プロパティ使用してデータ バッファリング無効にするコード例次に示します

 ' A new 'HttpWebRequest' object is created                 
 Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create("http://www.contoso.com/codesnippets/next.asp"),
 HttpWebRequest)
' AllowWriteStreamBuffering is set to 'false' 
 myHttpWebRequest.AllowWriteStreamBuffering = False
 Console.WriteLine(ControlChars.Cr + "Please Enter the data to
 be posted to the (http://www.contoso.com/codesnippets/next.asp) uri:")
 Dim inputData As String
 = Console.ReadLine()
 Dim postData As String
 = "firstone" + ChrW(61) + inputData
 ' 'Method' property of 'HttpWebRequest' class is set to POST.
 myHttpWebRequest.Method = "POST"
 Dim encodedData As New
 ASCIIEncoding()
 Dim byteArray As Byte()
 = encodedData.GetBytes(postData)
 ' 'ContentType' property of the 'HttpWebRequest' class is set to "application/x-www-form-urlencoded".
 myHttpWebRequest.ContentType = "application/x-www-form-urlencoded"
 ' If the AllowWriteStreamBuffering property of HttpWebRequest is set
 to false,then contentlength has to be set to length of data to be posted else Exception(411)
 Length required is raised.
  myHttpWebRequest.ContentLength=byteArray.Length
 Dim newStream As Stream = myHttpWebRequest.GetRequestStream()
 newStream.Write(byteArray, 0, byteArray.Length)
 newStream.Close()
 Console.WriteLine(ControlChars.Cr + "Data has been posted to
 the Uri" + ControlChars.Cr + ControlChars.Cr + "Please
 wait for the response..........")
 ' The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse'
 variable.
 Dim myHttpWebResponse As HttpWebResponse =
 CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
// Create a new 'HttpWebRequest' object to the mentioned Uri.      
          
HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://www.contoso.com/codesnippets/next.asp");
// Set AllowWriteStreamBuffering to 'false'. 
myHttpWebRequest.AllowWriteStreamBuffering=false;
Console.WriteLine("\nPlease Enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp)
 uri:");
string inputData =Console.ReadLine();
string postData="firstone="+inputData;
// Set 'Method' property of 'HttpWebRequest' class to POST.
myHttpWebRequest.Method="POST";
ASCIIEncoding encodedData=new ASCIIEncoding();
byte[]  byteArray=encodedData.GetBytes(postData);
// Set 'ContentType' property of the 'HttpWebRequest' class to "application/x-www-form-urlencoded".
myHttpWebRequest.ContentType="application/x-www-form-urlencoded";
// If the AllowWriteStreamBuffering property of HttpWebRequest is set
 to false,the contentlength has to be set to length of data to be posted else Exception(411)
 is raised.
myHttpWebRequest.ContentLength=byteArray.Length;
Stream newStream=myHttpWebRequest.GetRequestStream();
newStream.Write(byteArray,0,byteArray.Length);
newStream.Close();
Console.WriteLine("\nData has been posted to the Uri\n\nPlease wait for
 the response..........");
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse'
 variable.
HttpWebResponse myHttpWebResponse=(HttpWebResponse)myHttpWebRequest.GetResponse();
// Create a new 'HttpWebRequest' object to the mentioned Uri.
HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com/codesnippets/next.asp"
 ) );
// Set AllowWriteStreamBuffering to 'false'.
myHttpWebRequest->AllowWriteStreamBuffering = false;
Console::WriteLine( "\nPlease Enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp)
 uri:" );
String^ inputData = Console::ReadLine();
String^ postData = String::Concat( "firstone= ", inputData );
// Set 'Method' property of 'HttpWebRequest' class to POST.
myHttpWebRequest->Method = "POST";
ASCIIEncoding^ encodedData = gcnew ASCIIEncoding;
array<Byte>^ byteArray = encodedData->GetBytes( postData );
// Set 'ContentType' property of the 'HttpWebRequest' class to S"application/x-www-form-urlencoded".
myHttpWebRequest->ContentType = "application/x-www-form-urlencoded";
// If the AllowWriteStreamBuffering property of HttpWebRequest is set
 to false, the contentlength has to be set to length of data to be posted else Exception(411)
 is raised.
myHttpWebRequest->ContentLength = byteArray->Length;
Stream^ newStream = myHttpWebRequest->GetRequestStream();
newStream->Write( byteArray, 0, byteArray->Length );
newStream->Close();
Console::WriteLine( "\nData has been posted to the Uri\n\nPlease wait for
 the response.........." );
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse'
 variable.
HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse()
 );
// Create a new 'HttpWebRequest' object to the mentioned Uri.      
          
HttpWebRequest myHttpWebRequest = (HttpWebRequest)
    (WebRequest.Create("http://www.contoso.com/codesnippets/"
    + "next.asp"));
// Set AllowWriteStreamBuffering to 'false'. 
myHttpWebRequest.set_AllowWriteStreamBuffering(false);
Console.WriteLine("\nPlease Enter the data to be posted to the "
    + "(http://www.contoso.com/codesnippets/next.asp) uri:");
String inputData = Console.ReadLine();
String postData = "firstone=" + inputData;
// Set 'Method' property of 'HttpWebRequest' class to POST.
myHttpWebRequest.set_Method("POST");
ASCIIEncoding encodedData =  new ASCIIEncoding();
ubyte byteArray[] = encodedData.GetBytes(postData);
// Set 'ContentType' property of the 'HttpWebRequest' class to 
// "application/x-www-form-urlencoded".
myHttpWebRequest.set_ContentType
    ("application/x-www-form-urlencoded");
// If the AllowWriteStreamBuffering property of HttpWebRequest is
// set to false,the contentlength has to be set to length of data to
// be posted else Exception(411) is raised.
myHttpWebRequest.set_ContentLength(byteArray.length);
Stream newStream = myHttpWebRequest.GetRequestStream();
newStream.Write(byteArray, 0, byteArray.length);
newStream.Close();
Console.WriteLine("\nData has been posted to the Uri\n\nPlease "
    + "wait for the response..........");
// Assign the response object of 'HttpWebRequest' to a 
//'HttpWebResponse' variable.
HttpWebResponse myHttpWebResponse = (HttpWebResponse)
    (myHttpWebRequest.GetResponse());
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HttpWebRequest.AllowWriteStreamBuffering プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpWebRequest.AllowWriteStreamBuffering プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS