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

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

WebRequest.ContentType プロパティ

派生クラスオーバーライドされると、送信している要求データコンテンツ タイプ取得または設定します

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

例外例外
例外種類条件

NotImplementedException

プロパティ派生クラスオーバーライドされていないのに、そのプロパティ取得または設定試行されました。

解説解説

ContentType プロパティは、要求メディア タイプ格納します通常、これはコンテンツMIME エンコーディングです。

メモメモ

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

使用例使用例

ContentType プロパティ適切なメディア タイプ設定する例を次に示します


' 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();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebRequest クラス
WebRequest メンバ
System.Net 名前空間
HttpWebRequest.ContentType プロパティ


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS