I have a problem with Asp Net MVC4 web application. I am using Windows Authentication and IIS7. User is authenticated based on Active Directory and from time to time (like in 1-3% of all users attempts to the website) user is recognized as someone else who at the same time also entered the website (I checked it in IIS logs).
There is about 10 places in the code where I need to get user current name and I get this data using this:
HttpContext.Current.User.Identity.Name
I have already tried to cache username at the very beginning, when user enter the website and then use this cached username instead of accessing it via HttpContext. And surprisingly issue was occurring even more often.
I also tried to change settings in IIS like described here: https://serverfault.com/questions/360083/iis-7-windows-authentication-wrong-user
But issue still occurred.
Please let me know what else could I try? This issue really haunts me :) Thank you in advance for the answer!