語言

WindowsAccountType 列舉

定義

指定所使用的 Windows 帳號類型。

public enum class WindowsAccountType
public enum WindowsAccountType
[System.Serializable]
public enum WindowsAccountType
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum WindowsAccountType
[System.Runtime.InteropServices.ComVisible(true)]
public enum WindowsAccountType
type WindowsAccountType = 
[<System.Serializable>]
type WindowsAccountType = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type WindowsAccountType = 
[<System.Runtime.InteropServices.ComVisible(true)>]
type WindowsAccountType = 
Public Enum WindowsAccountType
繼承
WindowsAccountType
屬性

欄位

名稱 值 Description
Normal 0

一個標準使用者帳號。

Guest 1

一個 Windows 訪客帳號。

System 2

一個 Windows 系統帳號。

Anonymous 3

匿名帳號。

範例

以下範例展示如何使用 WindowsIdentity 建構子,為使用者建立一個新的 WindowsIdentity 類別實例,該使用者由指定的 Windows 帳號憑證、指定的認證類型及指定的 Windows 帳號類型所代表。 此程式碼範例是本類別更大範例 WindowsIdentity 的一部分。

void IntPtrStringTypeConstructor( IntPtr logonToken )
{
   
   // Construct a WindowsIdentity object using the input account token,
   // and the specified authentication type and Windows account type.
   String^ authenticationType = "WindowsAuthentication";
   WindowsAccountType guestAccount = WindowsAccountType::Guest;
   WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType,guestAccount );
   
   Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name );
}
private static void IntPtrStringTypeConstructor(IntPtr logonToken)
{
    // Construct a WindowsIdentity object using the input account token,
    // and the specified authentication type, and Windows account type.
    string authenticationType = "WindowsAuthentication";
    WindowsAccountType guestAccount = WindowsAccountType.Guest;
    WindowsIdentity windowsIdentity =
        new WindowsIdentity(logonToken, authenticationType, guestAccount);

    Console.WriteLine("Created a Windows identity object named " +
        windowsIdentity.Name + ".");
}
Private Sub IntPtrStringTypeConstructor(ByVal logonToken As IntPtr)
    ' Construct a WindowsIdentity object using the input account token,
    ' and the specified authentication type and Windows account type.
    Dim authenticationType As String = "WindowsAuthentication"
    Dim guestAccount As WindowsAccountType = WindowsAccountType.Guest
    Dim windowsIdentity As _
        New WindowsIdentity(logonToken, authenticationType, guestAccount)

    WriteLine("Created a Windows identity object named " + _
        windowsIdentity.Name + ".")
End Sub

備註

WindowsAccountType 列舉是由 WindowsIdentity 類別使用。

適用於