GuestHostNameFlags Enum

Namespace: System.Net.Security

Specifies the flags to be used when determining whether to perform a virtual account mapping. This enum is used by the System.Net.Security.NegotiateCredentials.GuestHostNameFlags property.

Syntax

public enum GuestHostNameFlags
// C#
public enum GuestHostNameFlags { ... }

Members

Remarks

The GuestHostNameFlags enum is used in conjunction with Windows authentication to control how guest account mappings are handled. It allows developers to specify whether the local computer's guest name or the domain's guest name should be used when attempting to map a remote user to a local guest account.

This is particularly relevant in scenarios where a client application is connecting to a server and needs to authenticate using a guest account. The flags provide fine-grained control over the authentication process.

Fields

Name Description
None No flags are specified. This is the default value.
UseGuestHostName Indicates that the guest host name should be used for mapping.
UseDomainGuestName Indicates that the domain guest name should be used for mapping.

Example

The following C# code snippet demonstrates how to set the GuestHostNameFlags property for a NegotiateCredentials object:

using System;
using System.Net.Security;

public class Example
{
    public static void Main()
    {
        // Create a NegotiateCredentials object
        NegotiateCredentials credentials = new NegotiateCredentials();

        // Set the GuestHostNameFlags to use the domain guest name
        credentials.GuestHostNameFlags = GuestHostNameFlags.UseDomainGuestName;

        // You can now use the 'credentials' object for authentication
        Console.WriteLine("GuestHostNameFlags set to: " + credentials.GuestHostNameFlags);
    }
}

Requirements

Assembly

System.dll

.NET Framework Versions

Supported in: 4.5, 4.5.1, 4.5.2, 4.5.3, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, .NET Core 2.0, .NET Standard 2.0, .NET 5+

See Also

System.Net.Security Namespace

System.Net.Security.NegotiateCredentials Class