WebRequest.GetRequestStream メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebRequest.GetRequestStream メソッドの意味・解説 

WebRequest.GetRequestStream メソッド

派生クラスオーバーライドされると、インターネット リソースデータ書き込むための Stream返します

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

Public Overridable Function
 GetRequestStream As Stream
Dim instance As WebRequest
Dim returnValue As Stream

returnValue = instance.GetRequestStream
public virtual Stream GetRequestStream ()
public:
virtual Stream^ GetRequestStream ()
public Stream GetRequestStream ()
public function GetRequestStream () : Stream

戻り値
インターネット リソースデータ書き込む Stream

例外例外
例外種類条件

NotImplementedException

メソッド派生クラスオーバーライドされていないのに、そのメソッドへのアクセス試行されました。

解説解説

GetRequestStream メソッドは、インターネット リソースデータ送信するために要求初期化しインターネット リソースデータ送信するための Stream インスタンス返します

GetRequestStream メソッドは、Stream への同期アクセス提供します非同期アクセスでは、BeginGetRequestStream メソッドと EndGetRequestStream メソッド使用します

メモメモ

WebRequest クラスは、abstract クラスです。実行時WebRequest インスタンス実際動作は、System.Net.WebRequest.Create メソッド返される派生クラスによって決まります既定値および例外詳細については、HttpWebRequest や FileWebRequest などの派生クラス説明参照してください

使用例使用例

GetRequestStream メソッド使用してストリーム取得し、そのストリームデータ書き込む例を次に示します


' Set the 'ContentType' property of the WebRequest.
myWebRequest.ContentType = "application/x-www-form-urlencoded"

' Set the 'ContentLength' property of the WebRequest.
myWebRequest.ContentLength = byteArray.Length
Dim newStream As Stream = myWebRequest.GetRequestStream()
newStream.Write(byteArray, 0, byteArray.Length)

' Close the Stream object.
newStream.Close()

' Assign the response object of 'WebRequest' to a 'WebResponse' variable.
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()

// Set the 'ContentType' property of the WebRequest.
myWebRequest.ContentType="application/x-www-form-urlencoded";

// Set the 'ContentLength' property of the WebRequest.
myWebRequest.ContentLength=byteArray.Length;
Stream newStream=myWebRequest.GetRequestStream();
newStream.Write(byteArray,0,byteArray.Length);

// Close the Stream object.
newStream.Close();

// Assign the response object of 'WebRequest' to a 'WebResponse' variable.
WebResponse myWebResponse=myWebRequest.GetResponse();

// Set the 'ContentType' property of the WebRequest.
myWebRequest->ContentType = "application/x-www-form-urlencoded";

// Set the 'ContentLength' property of the WebRequest.
myWebRequest->ContentLength = byteArray->Length;
Stream^ newStream = myWebRequest->GetRequestStream();
newStream->Write( byteArray, 0, byteArray->Length );

// Close the Stream object.
newStream->Close();

// Assign the response object of 'WebRequest' to a 'WebResponse' variable.
WebResponse^ myWebResponse = myWebRequest->GetResponse();
// Set the 'ContentType' property of the WebRequest.
myWebRequest.set_ContentType("application/x-www-form-urlencoded");
// Set the 'ContentLength' property of the WebRequest.
myWebRequest.set_ContentLength(byteArray.get_Length());
Stream newStream = myWebRequest.GetRequestStream();
newStream.Write(byteArray, 0, byteArray.get_Length());
// Close the Stream object.
newStream.Close();
// Assign the response object of 'WebRequest' to a 'WebResponse' 
// variable.
WebResponse myWebResponse = myWebRequest.GetResponse();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からWebRequest.GetRequestStream メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からWebRequest.GetRequestStream メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からWebRequest.GetRequestStream メソッド を検索

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

辞書ショートカット

すべての辞書の索引

WebRequest.GetRequestStream メソッドのお隣キーワード
検索ランキング

   

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



WebRequest.GetRequestStream メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS