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 时将使用的模拟级别。

适用于