Gets or sets the delegate called to determine the protocol used to authenticate clients.
Assembly: System (in System.dll)
member AuthenticationSchemeSelectorDelegate : AuthenticationSchemeSelector with get, set
If you want the same authentication protocol to be used for all requests handled by a particular instance of HttpListener, you do not need to set this property. To specify a protocol to be used for all client requests, use the AuthenticationSchemes property.
If the client has not specified authentication information in its headers, the HttpListener calls the specified delegate for each unauthenticated incoming request to determine which, if any, protocol to use to authenticate the client. The GetContext and EndGetContext methods return an incoming request only if the HttpListener successfully authenticated the request. If a request cannot be authenticated, the HttpListener automatically sends back a 401 response. You can get the identity of a successfully authenticated client using the HttpRequest.LogonUserIdentity property.
The ability to delegate the choice of authentication protocol to an application-specific method is useful if you want an instance of HttpListener to use different authentication protocols depending on the characteristics of the requests it receives (for example, the request's Url or UserHostAddress property).
The following code example sets the value of this property.
The following code example provides an implementation of a method invoked by an AuthenticationSchemeSelector delegate.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.