Last post Jun 07, 2016 07:57 AM by chester-thom
Jun 06, 2016 05:08 PM|chester-thom|LINK
I have a web application which uses AD authentication. I am generating a URL based on the current users AD profile. This works fine for the first user but when subsequent users log in, they are shown with details for the first user. I am getting the username
(Domain\UserId) as below:
private static stringusername = HttpContext.Current.User.Identity.Name;
Should I be using HttpContext to get the user ID or is there an alternative to HttpContext as I suspect this to be caching?
Jun 07, 2016 07:57 AM|chester-thom|LINK
My error, I had to instantiate string username = HttpContext.Current.User.Identity.Name inside my code block and not as a global variable.
Everything now works fine.