what is sessions and how to use sessions in asp.ne


Category: ASP.NET Tags: ASP.NET, C#

what is sessions and how to use sessions in asp.net

Like 1 Person
Asked on 29 May 2013
diksha

diksha
Atricles: 0
Questions: 1
Given Best Solutions: 0 *

Answers:

Nikhil Joshi
use this
for create session: 

session["new_session"] = "Dotnetlovers"; or

session.Add("new_session", "Dotnetlovers");

and for access:

string name = session["new_session"].ToString();
Like 1 Person on 29 May 2013
Alok Gupta
Session : when we open the web sites & finally close the web sites,the mean time is known as session.

How to create session in asp.net :

First Page:-
protected void Button1_Click(object sender, EventArgs e)
{
Session["username"] = TextBox1.Text;
Response.Redirect("default4.aspx");
}

Second Page:-
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("

Please welcome:" + Session["username"]);
}

Like 1 Person on 25 June 2013
alex
Very similar to the old good Classic ASP; I use multikey/value couple in both ASP/ASP.NET for authentication
Like 0 People on 4 December 2013

You are not loggedin, please login or signup to add comments:

Existing User

Login via:

New User



x