- An issue arises during Windows Integrated Authentication when two users attempt to log in simultaneously.
- Thread.CurrentPrincipal retains the reference of the preceding user for the subsequent login attempt made within a fraction of a second.
- So, if a second user tries to log in right after another, it ends up being seen as the first user who logged in
- This happens even though each user has their own session
Note – .NET Framework 4.8 is being used and have enabled Windows Authentication at IIS Site level
What all things I already tried
-
This issue only arises if two users try to log in simultaneously. If the second user logs in after the first user successfully gets in, then we don’t see this issue.
-
I tried using HttpContext.Current instead of Thread.CurrentPrincipal. But both hold the identity of the previous user.
New contributor
User255255 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.