In my ASP.net web application, after a user has authenticated via forms authentication, I'm trying to read the user name from HttpContext.Current.User.Identity.Name
.
When I run this on my personal machine running IIS Express, this works just fine. When I run it on a server under IIS 7.5, this expression always evaluate to string.Empty
.
Why is this and how can it be mitigated?
Note: This is not a duplicate of "HttpContext.Current.User.Identity.Name is Empty" because that question is about the web server built into Visual Studio.
Note 2: In my case anonymous access has not been turned off. If this is indeed the cause for the issue, can you please explain why?