简体   繁体   中英

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 testing 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM