We have developed a visual web part in asp.net. With using SPContext.Current.Web.CurrentUser.ID property, we control who is current user. In SharePoint, it is possible to change current user and this feature cause problem in web part. I am looking for a user change event in asp.net. Is there any event to control user change in asp.net?
So the question is actually about keeping a session variable in sync when a user logs out and back in as a different user. Here's how I'd do it:
Store the user's username in a session variable. On each Page_Load, check it against the current logged in user. If they are different you know they've changed.