We have an application which was built using ASP.NET Web Forms (it is not configured as web application), and now we are adding some new development using MVC4.
We used to able to use User.Identity.Name to retrieve the login information but after merged with MVC4, the value became blank when I launch with VS2010.
In the web.config, we set <authentication mode="Windows"/>
and also tried to add <deny users="?" /> according to some web sites recommendation, but it did not succeed.
Anyone can help?
I dont know for sure, but maybe System.Environment.UserName ( http://msdn.microsoft.com/en-us/library/system.environment.username.aspx ) will give you what you want? I
think this is for the username of a windows user. If you want the details of a user from the Simple membership providor, then Websecurity.CurrentUserName may be more appropriate.
Hope thats of some help.
Seems to me you’re looking for WindowsIdentity.GetCurrent().Name