Code Snippet posted by:
Tripati_tutu | Posted on: 3/18/2011 | Category:
ASP.NET Codes | Views: 2062 | Status:
[Member] |
Points: 40
|
Alert Moderator
To set a session:-
Session("SiteName") = "DotNetFunda"; //Here you directly assigning value
Session("SiteName") = txtGetSiteName.Text; //Here you will get the value from textbox.
To get the session value:-
txtShowSite.Text = Session("SiteName");
Suppose you want to clear the session variable, then write
Session("SiteName") = null;
If you want to clear all the session variables from your application, then use
Session.Abandon();
In case of ASP.NET application by default the ASP.NET session state is enabled.