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

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

HttpWebResponse.Server プロパティ

応答送信したサーバーの名前を取得します

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

例外例外
解説解説
使用例使用例

Server プロパティ使用してWeb サーバーの名前をコンソール表示する例を次に示します

Try
      Dim myHttpWebRequest As HttpWebRequest
 = CType(WebRequest.Create(url), HttpWebRequest)
      Dim myHttpWebResponse As HttpWebResponse
 = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
      Dim method As String
      method = myHttpWebResponse.Method
      If [String].Compare(method, "GET")
 = 0 Then
          Console.WriteLine(ControlChars.NewLine + "The GET method
 was successfully invoked on the following Web Server : {0}", myHttpWebResponse.Server)
      End If
      ' Releases the resources of the response.
      myHttpWebResponse.Close()
  Catch e As WebException
      Console.WriteLine(ControlChars.NewLine + "Exception Raised.
 The following error occured : {0}", e.Status)
  Catch e As Exception
      Console.WriteLine(ControlChars.NewLine + "The following
 exception was raised : {0}", e.Message)
  End Try
    try 
       {    
        // Creates an HttpWebRequest for the specified URL. 
            HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
 
            HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
 
            string method ;
            method = myHttpWebResponse.Method;
            if (String.Compare(method,"GET") == 0)
                Console.WriteLine("\nThe 'GET' method was successfully invoked
 on the following Web Server : {0}",
                                   myHttpWebResponse.Server);
            // Releases the resources of the response.
            myHttpWebResponse.Close();
      } 
    catch(WebException e) 
       {
            Console.WriteLine("\nWebException raised. The following error occured
 : {0}",e.Status); 
       }
    catch(Exception e)
        {
            Console.WriteLine("\nThe following Exception was raised : {0}"
,e.Message);
        }
}
try
{
   // Creates an HttpWebRequest for the specified URL.
   HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url
 ) );
   HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse()
 );
   String^ method;
   method = myHttpWebResponse->Method;
   if ( String::Compare( method, "GET" ) == 0 )
   {
      Console::WriteLine( "\nThe 'GET' method was successfully invoked on the
 following Web Server : {0}",
         myHttpWebResponse->Server );
   }
   // Releases the resources of the response.
   myHttpWebResponse->Close();
}
catch ( WebException^ e ) 
{
   Console::WriteLine( "\nWebException raised. The following error occured :
 {0}", e->Status );
}
catch ( Exception^ e ) 
{
   Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message
 );
}
    try {
        // Creates an HttpWebRequest for the specified URL. 
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)
            WebRequest.Create(url);
        HttpWebResponse myHttpWebResponse = (HttpWebResponse)
            myHttpWebRequest.GetResponse();
        String method;
        method = myHttpWebResponse.get_Method();
        if (String.Compare(method, "GET") == 0) {
            Console.WriteLine("\nThe 'GET' method was successfully invoked "
                + "on the following Web Server : {0}", 
                myHttpWebResponse.get_Server());
        }

        // Releases the resources of the response.
        myHttpWebResponse.Close();
    }
    catch (WebException e) {
        Console.WriteLine("\nWebException raised. The following error "
            + "occured : {0}", e.get_Status());
    }
    catch (System.Exception e) {
        Console.WriteLine("\nThe following Exception was raised : {0}",
 
            e.get_Message());
    }
} //GetPage
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS