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

要求の Content-Length ヘッダーの値。コンテンツの長さが不明な場合、この値は -1 です。


本体データの処理時に ContentLength64 プロパティを使用するコード例を次に示します。
public static void ShowRequestData (HttpListenerRequest request) { if (!request.HasEntityBody) { Console.WriteLine("No client data was sent with the request."); return; } System.IO.Stream body = request.InputStream; System.Text.Encoding encoding = request.ContentEncoding; System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); if (request.ContentType != null) { Console.WriteLine("Client data content type {0}", request.ContentType); } Console.WriteLine("Client data content length {0}", request.ContentLength64); Console.WriteLine("Start of client data:"); // Convert the data to a string and display it on the console. string s = reader.ReadToEnd(); Console.WriteLine(s); Console.WriteLine("End of client data:"); body.Close(); reader.Close(); // If you are finished with the request, it should be closed also. }

Windows 98, Windows Server 2003, Windows XP Media Center Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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

- HttpListenerRequest.ContentLength64 プロパティのページへのリンク