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

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

HttpListenerResponse.KeepAlive プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

サーバー永続的な接続要求しているかどうかを示す値を取得または設定します

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

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

このプロパティの値を設定するコード例次に示します

// When the client is not authenticated, there is no Identity.
if (context.User == null)
{
    message.Append ("<HTML><BODY><p> Hello local user! </p></BODY></HTML>");
}
else
{
    // Get the requester's identity.
    System.Security.Principal.WindowsIdentity identity = WindowsIdentity.GetCurrent();
    // Construct the response body.
    message.AppendFormat ("<HTML><BODY><p> Hello {0}!<br/>",
 
        identity.Name);
    message.AppendFormat ("You were authenticated using {0}.</p>",
 
        identity.AuthenticationType);
    message.Append ("</BODY></HTML>");
}

// Configure the response.
HttpListenerResponse response = context.Response;

// Use the encoding from the response if one has been set.
// Otherwise, use UTF8.
System.Text.Encoding encoding = response.ContentEncoding;
if (encoding == null)
{
    encoding = System.Text.Encoding.UTF8;
    response.ContentEncoding = encoding;
}
byte[] buffer = encoding.GetBytes (message.ToString ());
response.ContentLength64 = buffer.Length;
response.StatusCode = (int) HttpStatusCode.OK;
response.StatusDescription = "OK";
response.ProtocolVersion = new Version ("1.1");
// Don't keep the TCP connection alive; 
// We don't expect multiple requests from the same client.
response.KeepAlive = false;
// Write the response body.
System.IO.Stream stream = response.OutputStream;
stream.Write(buffer, 0, buffer.Length);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HttpListenerResponse クラス
HttpListenerResponse メンバ
System.Net 名前空間
HttpListener クラス
HttpListenerContext クラス
HttpListenerRequest クラス


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS