WindowsPrincipal.Identity Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the identity of the current principal.
public:
virtual property System::Security::Principal::IIdentity ^ Identity { System::Security::Principal::IIdentity ^ get(); };
public override System.Security.Principal.IIdentity Identity { get; }
public virtual System.Security.Principal.IIdentity Identity { get; }
member this.Identity : System.Security.Principal.IIdentity
Public Overrides ReadOnly Property Identity As IIdentity
Public Overridable ReadOnly Property Identity As IIdentity
Property Value
The WindowsIdentity object of the current principal.
Implements
Examples
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;
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
string username = wp.Identity.Name;
Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
Dim username As String = wp.Identity.Name
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.