Exposes the WindowIdentity object of the user represented by the WindowsPrincipal object.
[Visual Basic] Overridable Public ReadOnly Property Identity As IIdentity [C#] public IIdentity Identity {virtual get;} [C++] public: __property virtual IIdentity* get_Identity(); [JScript] public function get Identity() : IIdentity;
The following example retrieves the name of the user using the Identity property of the WindowsPrincipal object.
[C#]
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent()); String username = wp.Identity.Name;
WindowsPrincipal Class | WindowsPrincipal Members | System.Security.Principal Namespace