Export (0) Print
Expand All
Expand Minimize

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
/** @attribute FlagsAttribute() */ 
public enum AuthenticationSchemes
FlagsAttribute 
public enum AuthenticationSchemes

 Member nameDescription
AnonymousSpecifies anonymous authentication. 
BasicSpecifies basic authentication.  

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

DigestSpecifies digest authentication. 

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

IntegratedWindowsAuthenticationSpecifies Windows authentication. 
NegotiateNegotiates with the client to determine the authentication scheme. If both client and server support Kerberos, it is used; otherwise, NTLM is used. 
NoneNo 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. 
NtlmSpecifies 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;
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft