How can I get the user name of Windows Login?
I used these methods:
- Environment.UserName
- WindowsIdentity.GetCurrent().Name;
But, when I PUT this inside IIS server, it takes the name of the server, not my machine.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try
Page.User.Identity.Name. This should be what you’re looking for. This property is derived fromHttpContextand represents the logged in user security information for the current HTTP request.If the result is null, then I would suspect that the IIS settings is not configured properly. Try the advice in the following links:
http://forums.asp.net/t/1689878.aspx/1
HttpContext.Current.User.Identity.Name is Empty