Obtain the DomainNameUserName of the currently logged in user.
[C#]
//<-- Snippet Start --> // DESCRIPTION: // Obtain the DomainName_UserName of the currently logged in user. System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent(); System.String windowsLoginName = windowsIdentity.Name; //<-- Snippet End -->
[Visual Basic .NET]
'<-- Snippet Start --> ' DESCRIPTION: ' Obtain the DomainNameUserName of the currently logged in user. Dim windowsIdentity As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent Dim windowsLoginName As System.String = windowsIdentity.Name '<-- Snippet End -->