Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How set Object in Session variable?Thanks
Posted

as per my understading u want to ask that how to store object in session... its vary easy like
Session["YourObjectKey"] = object

and retrieve the object from the session is like
//Assume Student is your Class name
Student sObj = (Student)Session["YourObjectKey"];
 
Share this answer
 
Session variable can store any type of data in it with memory up to 2.2GB depend on size of your App_pool

here you can save/assign any value into a session variable




C#
Session["SessionVar"] = objYourObjectName;
 
Share this answer
 
another way to assign value in the session
Session.Add(Key,Value);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900