Click here to Skip to main content
15,846,899 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have kept dataset in session. And i want when user close the page then session set to null. I have lot of pages and other sessions also so i want to deallocate the value of this particular session only.
Thanx in advance.

1 solution


You can remove a particular session by

Session.Remove(your session object name);

Regarding your question

It depends on how much data you are placing in session.

Never place large amount of data in session as it consumes server resources(being server side state management technique).

Hope this helps.
Share this answer
Manish.Insan 14-Dec-11 6:34am    
i want, when user close or leave that page then session set to null. so where should i write Session.Remove(__)?

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