This document is archived and information here might be outdated.  Recommended version.


Statements - Get DomainNameUserName Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Statements - Get DomainNameUserName Snippet

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 -->

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • System