Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

AuthenticationSchemes Enumeration

Specifies protocols for authentication.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Net
Assembly:  System (in System.dll)
[FlagsAttribute]
public enum AuthenticationSchemes
Member nameDescription
Supported in .NET for Windows Store appsAnonymousSpecifies anonymous authentication.
Supported in .NET for Windows Store appsBasicSpecifies basic authentication.

For additional information, see RFC2617 – HTTP Authentication: Basic and Digest Authentication. This document is available at http://www.rfc-editor.org.

Supported in .NET for Windows Store appsDigestSpecifies digest authentication.

For additional information, see RFC2617 – HTTP Authentication: Basic and Digest Authentication. This document is available at http://www.rfc-editor.org

Supported in .NET for Windows Store appsIntegratedWindowsAuthenticationSpecifies Windows authentication.
Supported in .NET for Windows Store appsNegotiateNegotiates with the client to determine the authentication scheme. If both client and server support Kerberos, it is used; otherwise, NTLM is used.
Supported in .NET for Windows Store appsNoneNo authentication is allowed. A client requesting an HttpListener object with this flag set will always receive a 403 Forbidden status. Use this flag when a resource should never be served to a client.
Supported in .NET for Windows Store appsNtlmSpecifies NTLM authentication.

This enumeration is used to specify the method used to authenticate client requests being processed by HttpListener objects.

Note   Basic authentication requires the exchange of a password and should therefore be avoided except in the case of secure, encrypted connections.

The following code example demonstrates using the Negotiate enumeration value to specify that clients are authenticated using the Negotiate security protocol.

Console.WriteLine("Listening for {0} prefixes...", listener.Prefixes.Count);
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
Console.WriteLine("Received a request.");
// This server requires a valid client certificate 
// for requests that are not sent from the local computer. 

// Did the client omit the certificate or send an invalid certificate? 
if (request.IsAuthenticated &&
    request.GetClientCertificate() == null || 
    request.ClientCertificateError != 0)
{
    // Send a 403 response.
    HttpListenerResponse badCertificateResponse = context.Response ;
    SendBadCertificateResponse(badCertificateResponse);
    Console.WriteLine("Client has invalid certificate.");
    continue;
}

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, 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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.