WebRequest.ContentLength プロパティ
アセンブリ: System (system.dll 内)

Dim instance As WebRequest Dim value As Long value = instance.ContentLength instance.ContentLength = value
/** @property */ public long get_ContentLength () /** @property */ public void set_ContentLength (long value)
送信している要求データのバイト数。


ContentLength プロパティは、WebRequest インスタンスによってインターネット リソースに送信されるデータのバイト数を格納します。
![]() |
---|
WebRequest クラスは、abstract クラスです。実行時の WebRequest インスタンスの実際の動作は、System.Net.WebRequest.Create メソッドで返される派生クラスによって決まります。既定値および例外の詳細については、HttpWebRequest や FileWebRequest などの派生クラスの説明を参照してください。 |

ContentLength プロパティを発信バイト バッファのバイト数の値に設定する例を次に示します。
' 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();

Windows 98, Windows 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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からWebRequest.ContentLength プロパティを検索する場合は、下記のリンクをクリックしてください。

- WebRequest.ContentLength プロパティのページへのリンク