WindowsIdentity.GetCurrent Method (TokenAccessLevels)


Returns a WindowsIdentity object that represents the current Windows user, using the specified desired token access level.

Namespace:   System.Security.Principal
Assembly:  mscorlib (in mscorlib.dll)

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
public static WindowsIdentity GetCurrent(
	TokenAccessLevels desiredAccess


Type: System.Security.Principal.TokenAccessLevels

A bitwise combination of the enumeration values.

Return Value

Type: System.Security.Principal.WindowsIdentity

An object that represents the current user.

The desiredAccess parameter specifies an access mask that identifies the requested types of access to the access token. These requested access types are compared with the token's discretionary access control list (DACL) to determine which types of access are granted or denied.


for ability to manipulate the principal object. Associated enumeration: SecurityPermissionFlag.ControlPrincipal.

.NET Framework
Available since 2.0
Return to top