共用方式為


WindowsIdentity.ImpersonationLevel 屬性

定義

設定使用者的模擬層級。

public:
 property System::Security::Principal::TokenImpersonationLevel ImpersonationLevel { System::Security::Principal::TokenImpersonationLevel get(); };
public System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; }
[System.Runtime.InteropServices.ComVisible(false)]
public System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; }
member this.ImpersonationLevel : System.Security.Principal.TokenImpersonationLevel
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.ImpersonationLevel : System.Security.Principal.TokenImpersonationLevel
Public ReadOnly Property ImpersonationLevel As TokenImpersonationLevel

屬性值

其中一個列舉值,這個值指定模擬層級。

屬性

範例

下列程式代碼範例示範如何使用 ImpersonationLevel 屬性來顯示目前使用者的模擬層級。 此程式代碼範例是提供給 類別之較大範例的 WindowsIdentity 一部分。

TokenImpersonationLevel token = windowsIdentity.ImpersonationLevel;
Console.WriteLine("The impersonation level for the current user is : " + token.ToString());
Dim token As TokenImpersonationLevel
token = windowsIdentity.ImpersonationLevel
Console.WriteLine("The impersonation level for the current user is : " + token.ToString())

備註

描述用來連接至 WMI 的模擬等級。

適用於