GetCurrent Method (Boolean)
Collapse the table of content
Expand the table of content

WindowsIdentity.GetCurrent Method (Boolean)

Returns a WindowsIdentity object that represents the Windows identity for either the thread or the process, depending on the value of the ifImpersonating parameter.

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

public static WindowsIdentity GetCurrent (
	bool ifImpersonating
public static WindowsIdentity GetCurrent (
	boolean ifImpersonating
public static function GetCurrent (
	ifImpersonating : boolean
) : WindowsIdentity
Not applicable.



true to return the WindowsIdentity only if the thread is currently impersonating; false to return the WindowsIdentity of the thread if it is impersonating or the WindowsIdentity of the process if the thread is not currently impersonating.

Return Value

A WindowsIdentity object that represents a Windows user.

If ifImpersonating is true and the thread is not impersonating, the returned WindowsIdentity object has no value. If ifImpersonating is false and the thread is impersonating, the WindowsIdentity for the thread is returned. If ifImpersonating is false and the thread is not impersonating, the WindowsIdentity for the process is returned.

Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2016 Microsoft