WindowsPrincipal.Identity Property


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

Gets the identity of the current principal.

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

Public Overrides ReadOnly Property Identity As IIdentity

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.

Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
Dim username As String = wp.Identity.Name

.NET Framework
Available since 1.1
Return to top