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

Dim instance As HttpListener Dim value As AuthenticationSchemeSelector value = instance.AuthenticationSchemeSelectorDelegate instance.AuthenticationSchemeSelectorDelegate = value
public: property AuthenticationSchemeSelector^ AuthenticationSchemeSelectorDelegate { AuthenticationSchemeSelector^ get (); void set (AuthenticationSchemeSelector^ value); }
/** @property */ public AuthenticationSchemeSelector get_AuthenticationSchemeSelectorDelegate () /** @property */ public void set_AuthenticationSchemeSelectorDelegate (AuthenticationSchemeSelector value)
public function get AuthenticationSchemeSelectorDelegate () : AuthenticationSchemeSelector public function set AuthenticationSchemeSelectorDelegate (value : AuthenticationSchemeSelector)
認証プロトコルの選択に使用されるメソッドを呼び出す AuthenticationSchemeSelector デリゲート。既定値は null 参照 (Visual Basic では Nothing) です。


![]() |
---|
HttpListener の特定のインスタンスで処理されるすべての要求に対して同じ認証プロトコルを使用する場合は、このプロパティを設定する必要はありません。すべてのクライアント要求に対して使用するプロトコルを指定するには、AuthenticationSchemes プロパティを使用します。 |
クライアントがヘッダーで認証情報を指定していない場合、HttpListener は、未認証の各受信要求について、指定されたデリゲートを呼び出して、クライアントの認証に使用するプロトコル (存在する場合) を決定します。GetContext メソッドおよび EndGetContext メソッドは、HttpListener が正常に要求を認証した場合だけ、受信要求を返します。要求を認証できない場合、HttpListener は、自動的に 401 応答を返します。System.Net.HttpListenerRequest.LogonUserIdentity プロパティを使用して、正常に認証されたクライアントの ID を取得できます。
認証プロトコルの選択をアプリケーション固有のメソッドにデリゲートする機能は、HttpListener のインスタンスに、受信した要求の特性 (要求の Url プロパティや UserHostAddress プロパティなど) に応じて異なる認証プロトコルを使用する場合に便利です。

// Set up a listener. HttpListener listener = new HttpListener(); HttpListenerPrefixCollection prefixes = listener.Prefixes; prefixes.Add(@"http://localhost:8080/"); prefixes.Add(@"http://contoso.com:8080/"); // Specify the authentication delegate. listener.AuthenticationSchemeSelectorDelegate = new AuthenticationSchemeSelector (AuthenticationSchemeForClient); // Start listening for requests and process them // synchronously. listener.Start();
AuthenticationSchemeSelector デリゲートによって呼び出されるメソッドの実装を提供するコード例を次に示します。
static AuthenticationSchemes AuthenticationSchemeForClient(HttpListenerRequest request) { Console.WriteLine("Client authentication protocol selection in progress..."); // Do not authenticate local machine requests. if (request.RemoteEndPoint.Address.Equals (IPAddress.Loopback)) { return AuthenticationSchemes.None; } else { return AuthenticationSchemes.IntegratedWindowsAuthentication; } }

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


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

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