Get the windows login name

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,
you could use the following code for the same.

System.Security.Principal.WindowsPrincipal wp = new
System.Security.Principal.WindowsPrincipal
(System.Security.Principal.WindowsIdentity.GetCurrent());

MessageBox.Show(wp.Identity.Name);

Here the messagebox displays the domain name alongwith the
user logged in(the UseriD). Using the ID, you could
validate the user.

HTH irfan
 

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