Session in ASP.NET is a way to store user specific information on Server side which will not be visible to User in any form and its all up to you how you want to use Session to store User Information. As these Session variables consume some disk space on your Server, so you should Clear all those Session variables which are of no use.
- If you want to Clear all the Session variables you have created, you can use any of the following command.
- Upper lines of code will clear all the Session variables but Session is still open for the user. So, if any time you want to close the Session for a user, you have to abandon it by using following command.
- If you want to remove a particular variable from Session not all, then you have to use Remove method of Session class.
Incoming search terms:
- destroy all session variables when close browser in asp net (1)
- how to clear single session variable (1)