1

I have an ASP.Net MVC site that is running on an internal server. A view on the site uses @HttpContext.Current.User.Identity.Name to display the name of the user accessing the site via browser. The Authentication mode is set to Windows.

When run on one of our servers it works as expected. When the same code is run on a second server the whole Identity object appears to be empty. This second server is a bit more isolated via firewall compared to the first server.

What sort of rules could be preventing the Identity object from being filled?

In the web.config I also have

<authorization> <deny users="?" /> </authorization>

Which should prevent any anonymous users from accessing the site. Since I am able to view the site I assume that it sees that I am authorized.

  • ASP.Net MVC v5.2.7.0
  • .Net Framework v4.6.1
  • Win Server 2012 IIS 8.5
John S
  • 7,213
  • 17
  • 65
  • 125
  • 2
    Just try to see, if this link helps: https://stackoverflow.com/questions/1571036/httpcontext-current-user-identity-name-is-empty – Krish Jun 28 '19 at 05:44
  • Possible duplicate of [HttpContext.Current.User.Identity.Name is Empty](https://stackoverflow.com/questions/1571036/httpcontext-current-user-identity-name-is-empty) – Tony Abrams Jun 28 '19 at 19:49

1 Answers1

1

Anonymous and Windows authentication were both turned on. Needed to turn off Anonymous.

John S
  • 7,213
  • 17
  • 65
  • 125