How to get windows user ID in C# web application (asp.net 2.0)?
Posted on 2008-06-25
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.