What can cause incorrect user names when using IIS & Windows Authentication?

  asp.net, authentication, iis, windows

I’m currently experiencing an issue with some users of an ASP.NET 4.8 Web API application hosted on Windows Server 2012 and IIS. The following properties are not returning that user’s correct user name, and instead returning the name of a service account used for this server:

  • HttpContext.Current.User.Identity.Name
  • HttpContext.Current.Request.LogonUserIdentity.Name

I have no idea how to being troubleshooting this – myself and most other users do not experience this issue, but for a handful of users the above does not return the correct username, returning the username of a service account used to remotely connect to the server in question. Forcing a login via a browser private window does rectify the issue, and the application correctly returns the expected username for each of the above properties.

What could be a cause for Windows Authentication not returning the correct user name and what is the best way to troubleshoot an issue like this?

Source: Windows Questions