WindowsPrincipal::Identity Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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: