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

Dim instance As HttpListener Dim value As AuthenticationSchemes value = instance.AuthenticationSchemes instance.AuthenticationSchemes = value
public: property AuthenticationSchemes AuthenticationSchemes { AuthenticationSchemes get (); void set (AuthenticationSchemes value); }
/** @property */ public AuthenticationSchemes get_AuthenticationSchemes () /** @property */ public void set_AuthenticationSchemes (AuthenticationSchemes value)
public function get AuthenticationSchemes () : AuthenticationSchemes public function set AuthenticationSchemes (value : AuthenticationSchemes)
クライアントの認証方法を示す AuthenticationSchemes 列挙値のビットごとの組み合わせ。既定値は Anonymous です。


HttpListener は、指定された方式を使用して、すべての受信要求を認証します。GetContext メソッドおよび EndGetContext メソッドは、HttpListener が正常に要求を認証した場合だけ、受信クライアント要求を返します。
HttpListenerContext.User プロパティを使用して、正常に認証されたクライアントの ID を確認できます。
HttpListener オブジェクトが受信した要求の特性 (Url プロパティまたは UserHostName プロパティ) に応じて異なる認証方式を使用するようにするには、認証方式を選択するメソッドを実装する必要があります。この方法の詳細については、AuthenticationSchemeSelectorDelegate プロパティのドキュメントを参照してください。
![]() |
---|
このプロパティを設定して Digest、NTLM、または Negotiate を有効にするには、SecurityPermission と ControlPrincipal が必要です。 |

AuthenticationSchemes プロパティを使用して認証方式を指定するコード例を次に示します。
public static void SimpleListenerWithUnsafeAuthentication(string[] prefixes) { // URI prefixes are required, // for example "http://contoso.com:8080/index/". if (prefixes == null || prefixes.Length == 0) throw new ArgumentException("prefixes"); // Set up a listener. HttpListener listener = new HttpListener(); foreach (string s in prefixes) { listener.Prefixes.Add(s); } listener.Start(); // Specify Negotiate as the authentication scheme. listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate; // If NTLM is used, we will allow multiple requests on the same // connection to use the authentication information of first request. // This improves performance but does reduce the security of your // application. listener.UnsafeConnectionNtlmAuthentication = true; // This listener does not want to receive exceptions // that occur when sending the response to the client. listener.IgnoreWriteExceptions = true; Console.WriteLine("Listening..."); // ... process requests here. listener.Close(); }

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


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

- HttpListener.AuthenticationSchemes プロパティのページへのリンク