Return to Snippet

Revision: 31580
at September 10, 2010 00:39 by housecor


Updated Code
//On Login page
User currentUser = <get the User entity here, including relations to UserRights>;
Session.Add("CurrentUser", currentUser);

//On another page
User restoredUser = Session["CurrentUser"] as User;
if (restoredUser != null)
{
	//use the User entity here to check user's rights
}

Revision: 31579
at September 9, 2010 04:04 by housecor


Initial Code
//In Login page
User currentUser = <get the User entity here, including relations to UserRights>;
Session.Add("CurrentUser", currentUser);

//In another page
User restoredUser = Session["CurrentUser"] as User;
if (restoredUser != null)
{
	//use the User entity here for (as example) to check user's rights
}

Initial URL


Initial Description


Initial Title
Store/retrieve object in session

Initial Tags
object

Initial Language
C#