0

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?

2
  • If a person logs in as a different user, it'll trigger a full page request (several actually) so this isn't really a valid scenario. Every page load is a separate life cycle. Commented Apr 25, 2018 at 13:55
  • I have a session for the current user. However, after a new user login, the information of the previous user display in web part unless the new user close browser and open it again.
    – Mohammad
    Commented Apr 25, 2018 at 17:02

1 Answer 1

0

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.