WindowsIdentity.ImpersonationLevel 屬性
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定使用者的模擬層級。
public:
property System::Security::Principal::TokenImpersonationLevel ImpersonationLevel { System::Security::Principal::TokenImpersonationLevel get(); };
C#
public System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; }
C#
[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 一部分。
C#
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 的模擬等級。
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, 6, 7, 8, 9, 10 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |