Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WindowsPrincipal::Identity Property

 

Gets the identity of the current principal.

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

public:
property IIdentity^ Identity {
	virtual IIdentity^ get() override;
}

Property Value

Type: System.Security.Principal::IIdentity^

The WindowsIdentity object of the current principal.

The following example retrieves the name of the user by using the Identity property of the WindowsPrincipal object.

WindowsPrincipal^ wp = gcnew WindowsPrincipal( WindowsIdentity::GetCurrent() );
String^ username = wp->Identity->Name;

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft