Skip to main content
Rollback to Revision 1
Source Link
juan
  • 82.3k
  • 52
  • 165
  • 198

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Remove change to answer; this option was from a different answer
Source Link
Ryan M
  • 20.6k
  • 35
  • 75
  • 85

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Option B)

string userName = Environment.UserName

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Option B)

string userName = Environment.UserName

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Provides a summary of why these two options are correct and links to the official documentation of both
Source Link
Mike
  • 2.5k
  • 4
  • 17
  • 31

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Option B)

string userName = Environment.UserName
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Option A)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Option B)

string userName = Environment.UserName
Source Link
juan
  • 82.3k
  • 52
  • 165
  • 198
Loading