Click here to Skip to main content
14,869,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Please help me to release all of the memory used by session variables very soon after leaving the page. i am getting out of memory exception.

Thanks
Sherin
Posted
Comments
Sushil Mate 26-Jul-13 8:41am
   
Try viewstate.

There are two ways.Refer this link

What is the difference between Session.Abandon() and Session.Clear()

It states that:

1) Session.clear()-Removes all keys and values from the session-state collection.

2) Session.Abandon()-Removes all the objects stored in a Session. If you do not call the Abandon method explicitly, the server removes these objects and destroys the session when the session times out.It also raises events like Session_End.

Quote:
Session.Clear can be compared to removing all books from the shelf, while Session.Abandon is more like throwing away the whole shelf.

Regards..:laugh:
   
v3
Comments
Sushil Mate 26-Jul-13 5:53am
   
Hey rohan, try adding the reference from where you coping the contents or put in the quotes, reference needed. especially quotes. I'm afraid it could lead to plagiarism. I have seen it here before. Hope you understand what im trying to say. :)
Thanks7872 26-Jul-13 5:56am
   
I appreciate your feedback. Actually i have already answered this type of question before. you can find it here.

http://www.codeproject.com/Answers/590730/how-to-clear-a-session-after-logout#answer3

Where i posted reference also,but this time i forgot it. My bad. :-(
Sushil Mate 26-Jul-13 6:01am
   
No worries you can update this one too, by the way I liked that quote :)
Thanks7872 26-Jul-13 6:02am
   
:-)
Thanks7872 26-Jul-13 6:00am
   
Updated accordingly.
Sushil Mate 26-Jul-13 6:02am
   
great.
Try this
Session["Sessionname"]="";
   
Comments
sudevsu 2-Apr-15 11:18am
   
This is doesn't mean it clears out the session. It still holds a value of " " means empty

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