Session in asp.net c#  

by ne on 2021-03-02 under Asp.net

In this example you will see how we can create the session and can get the value from the session and can also abandon the session.

Creating session:-

Session["name"]=TextBox1.Text;
    Session["email"]=TextBox2.Text;

Get Session Value:-

Label1.Text=Session["name"].ToString();
    Label2.Text=Session["email"].ToString();

Remove values from the session:-

Session.Remove("name");
    Session.Remove("email");

Abandon the session or removing all the sessions:-

Sessiom.Abandon();

Thanks