TmschAuthenticationTypes Enumeration

Namespace: System.Net.Security

Type: Enumeration

Defines the authentication types that can be used to authenticate a client and server application.

Syntax

public enum TmschAuthenticationTypes

Members

Member Description
Anonymous Specifies that the authentication is anonymous. No credentials are required.
Basic Specifies that Basic authentication is used. Credentials are sent in clear text.
Digest Specifies that Digest authentication is used. Credentials are sent as a hash.
Negotiate Specifies that Negotiate authentication (e.g., Kerberos) is used. This is often the default for Windows environments.
Ntlm Specifies that NTLM authentication is used.
MutualAuth Specifies that mutual authentication is used, where both client and server authenticate each other.
Kerberos Specifies that Kerberos authentication is used.
All Specifies that all available authentication types are supported.

Remarks

The TmschAuthenticationTypes enumeration is used to specify the authentication mechanisms that can be employed when establishing a secure connection between a client and a server. This enumeration is particularly relevant in scenarios involving protocols like HTTP or FTP where authentication is crucial for security and access control.

When configuring a client or server application, you can specify one or more of these authentication types to determine how identities are verified. The All member allows for negotiation and selection of the most appropriate authentication method supported by both parties.

It is important to note that the specific authentication methods available and their security implications can vary based on the underlying operating system and network configuration. For sensitive applications, prefer stronger authentication mechanisms like Negotiate (Kerberos) or MutualAuth over Basic authentication, which sends credentials in plain text.

Example

The following C# code snippet demonstrates how to specify Basic and Anonymous authentication for an HttpWebRequest:


using System;
using System.Net;
using System.Net.Security;

public class Example {
    public static void Main() {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://example.com/secure/data");

        // Setting authentication types
        request.AuthenticationTypes = AuthenticationTypes.Basic | AuthenticationTypes.Anonymous;

        // Optionally set credentials if Basic authentication is chosen and required
        // request.Credentials = new NetworkCredential("username", "password");

        try {
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
                Console.WriteLine("Response received. Status code: {0}", response.StatusCode);
                // Process the response...
            }
        } catch (WebException ex) {
            Console.WriteLine("Error: {0}", ex.Message);
        }
    }
}
                

Requirements

| |
Namespace System.Net.Security
Assembly System (in System.dll)
.NET Framework versions Available in .NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, 4.8.