Details of my app:
– ASP.NET MVC 3
– Windows Authentication mode
– IIS 6
So, in the web.config i put the impersonate to false, but when i try get the current user with Environment.UserName the app keeps getting the NETWORK SERVICE user. Why?
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.
To get the current user in an ASP.NET MVC application you should use the User.Identity.Name property:
Environment.UserNamegives you the account under which the application pool executes.Also make sure that in IIS you have disabled anonymous authentication in the properties of the virtual directory and left only Windows authentication checked.