Link to home
Start Free TrialLog in
Avatar of sacvb
sacvb

asked on

How to get windows user ID in C# web application (asp.net 2.0)?

How to get windows user ID in C# web application?
To clarify, I am talking about login ID that user uses to login to his working machine. (he/she has to press Ctrl-Alt-Del and enter login and password to start working)

I was looking around and  one of the suggestion was to use:  System.Environment.UserName;
But, this gives (by my opinion) account name under which the application is logged to the server that hosts application. In my case I get "ASPNET" and that is not my windows ID.

I assume that for this I will have to connect to Active Directory. How can I do that and how to query Active Directory. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Chumad
Chumad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chumad
Chumad

string authUser = Page.User.Identity.Name;
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sacvb

ASKER

Thanks all