MVC obtaining active directory user name
How do you obtain the username of the logged in user with MVC2 in ASP.NET web forms I used to do it with:
User.Identity.Name
This works when I am te开发者_StackOverflow中文版sting on my local machine using visual studio but no longer works once the project is published to the test server.
Thanks
This turned out to be a setting on the Virtual Directory. The option "enable anonymous access" was selected. Once this was de-selected everything worked as expected.
精彩评论