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

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

HttpWebResponse.ContentEncoding プロパティ

応答本文エンコードするために使用するメソッド取得します

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

Dim instance As HttpWebResponse
Dim value As String

value = instance.ContentEncoding
public string ContentEncoding { get;
 }
public:
property String^ ContentEncoding {
    String^ get ();
}
/** @property */
public String get_ContentEncoding ()
public function get ContentEncoding
 () : String

プロパティ
応答本文エンコードするために使用するメソッド記述する文字列

例外例外
解説解説

ContentEncoding プロパティは、応答返される Content-Encoding ヘッダーの値を格納します

使用例使用例

ContentEncoding プロパティ使用して応答返される Content-Encoding ヘッダーの値を取得する例を次に示します

Try
   Dim myHttpWebRequest As HttpWebRequest =
 CType(WebRequest.Create(url), HttpWebRequest)
   Dim myHttpWebResponse As HttpWebResponse
 = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
   
   Console.WriteLine(("The encoding method used is: "
 + myHttpWebResponse.ContentEncoding))
   Console.WriteLine(("The character set used is :"
 + myHttpWebResponse.CharacterSet))
   
   Dim seperator As Char
 = "/"c
   Dim contenttype As [String] = myHttpWebResponse.ContentType
   ' Retrieve 'text' if the content type is of 'text/html.
   Dim maintype As [String] = contenttype.Substring(0,
 contenttype.IndexOf(seperator))
   ' Display only 'text' type.
   If [String].Compare(maintype, "text")
 = 0 Then
      Console.WriteLine(ControlChars.NewLine + " Content type is
 'text'.")
      
try 
       {    
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
 
        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
 

        Console.WriteLine("The encoding method used is: " + myHttpWebResponse.ContentEncoding);
        Console.WriteLine("The character set used is :"
 + myHttpWebResponse.CharacterSet);

        char seperator = '/';
        String contenttype = myHttpWebResponse.ContentType;
        // Retrieve 'text' if the content type is of 'text/html.
        String maintype = contenttype.Substring(0,contenttype.IndexOf(seperator));
        // Display only 'text' type.
        if (String.Compare(maintype,"text") == 0) 
            {
            Console.WriteLine("\n Content type is 'text'.");

try
{
   HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url
 ) );
   HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse()
 );

   Console::WriteLine( "The encoding method used is: {0}", myHttpWebResponse->ContentEncoding
 );
   Console::WriteLine( "The character set used is : {0}",
 myHttpWebResponse->CharacterSet );

   char separator = '/';
   String^ contenttype = myHttpWebResponse->ContentType;
   // Retrieve 'text' if the content type is of 'text/html.
   String^ maintype = contenttype->Substring( 0, contenttype->IndexOf( separator
 ) );
   // Display only 'text' type.
   if ( String::Compare( maintype, "text" ) == 0 )
   {
      Console::WriteLine( "\n Content type is 'text'." );
try {
    HttpWebRequest myHttpWebRequest = (HttpWebRequest)
        WebRequest.Create(url);
    HttpWebResponse myHttpWebResponse = (HttpWebResponse)
        myHttpWebRequest.GetResponse();
    Console.WriteLine("The encoding method used is: " 
        +  myHttpWebResponse.get_ContentEncoding());
    Console.WriteLine("The character set used is :"
 
        +  myHttpWebResponse.get_CharacterSet());
    char seperator = '/';
    String contentType = myHttpWebResponse.get_ContentType();

    // Retrieve 'text' if the content type is of 'text/html.
    String mainType = contentType.Substring(0,
        contentType.IndexOf(seperator));

    // Display only 'text' type.
    if (String.Compare(mainType,"text") == 0) {
        Console.WriteLine("\n Content type is 'text'.");
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS