Logon userId

  • Thread starter Thread starter Gilbert Tordeur
  • Start date Start date
G

Gilbert Tordeur

In a windows form, how can I retrieve the Windows userid (what we type in
the Ctrl-Alt-Suppr dialog box) of the current user ? Thank you.
 
Environment.UserName
Or
Environment.GetEnvironmentVariable("USERNAME")

In a windows form, how can I retrieve the Windows userid (what we type in
the Ctrl-Alt-Suppr dialog box) of the current user ? Thank you.
 
* "Gilbert Tordeur said:
In a windows form, how can I retrieve the Windows userid (what we type in
the Ctrl-Alt-Suppr dialog box) of the current user ? Thank you.

'Environment.UserName' or 'SystemInformation.UserName'.
Notice that the latter would require a reference to
"System.Windows.Forms.dll", and that's not the preferred way for
console/service applications.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top