Posted By

housecor on 09/09/10


Tagged

session object store


Versions (?)

Store/retrieve object in session


 / Published in: C#
 

  1. //On Login page
  2. User currentUser = <get the User entity here, including relations to UserRights>;
  3. Session.Add("CurrentUser", currentUser);
  4.  
  5. //On another page
  6. User restoredUser = Session["CurrentUser"] as User;
  7. if (restoredUser != null)
  8. {
  9. //use the User entity here to check user's rights
  10. }

Report this snippet  

You need to login to post a comment.