John McCloskey
John McCloskey

Reputation: 117

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

Upvotes: 1

Views: 153

Answers (1)

John McCloskey
John McCloskey

Reputation: 117

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.

Upvotes: 1

Related Questions