windows xp logon in C# program

  • Thread starter Thread starter Hugo Lefevre
  • Start date Start date
H

Hugo Lefevre

Dear,

I want to know how you can use your logon under windows in a C# program (I
use windows xp pro). I want to make a form that has to be filled in and I
want to know who has filled in the form by using the logon under windows. Is
this possible and if it is yes how?

Thank you very much.
 
Hi,

For starters, you could try to use the WindowsIdentity class for example:
WindowsIdentity myID = WindowsIdentity.GetCurrent();
Then use the name property to get the current user. That is for a desktop
appplication. For web apps use the Page object like this:
Page.User.Identity.Name
In both ways you will get the DOMAIN\user string. For the web app, you
will have to use integrated authentication in your webb app.

Cheers!
 
Back
Top