We know HTTP is stateless Protocol, it means a new instance of
webpage class created each time the page post back. It can’t hold data on page.
So to maintain data between different pages, we use Session. Session provides
the facility to store information on server.
Remove sessions in VB.NET:
In this article I will explain how to remove sessions in
ASP.NET.
Store Information in
Session in C#:
//Storing UserName in Session
Session["SessionName "] = txtUser.Text;
In VB.Net
'Storing UserName in Session
Session("SessionName ")= txtUser.Text
Remove sessions in
asp.net using C#:
To
remove particular session.
//Remove Particular session
Session.Remove("SessionName");
or
Session["SessionName"] = null;
To
remove all sessions created in Application:
//Remove all sessions
Session.RemoveAll();
or
Session.Abandon();
Remove sessions in VB.NET:
To
remove particular session :
'Remove Particular session
Session.Remove("SessionName ")
or
Session("SessionName ") = Nothing
To
remove all sessions created in the application:
'Remove all sessions
Session.RemoveAll()
or
Session.Abandon()