Session object is mainly
used to store the data and pass it from one page to another page in your applications.
syntax to use sessions
syntax to use sessions
session["username"]=txtusername.Text;
To retrive the value in the session:
string username=convert.tostring(session["username"]);
U can store a single variable or objects like dataset,datatable, array etc also in the sessions.
Once u close u r application, u r session data will be lost.
u have following types of session management in asp.net which u can define in your web.config file
session mode="inproc"...means the session will be stored on the webserver within u r application
session mode="outproc"....means session will be stored on the server outside u r application
session mode="stateserver"...means session will be stored in a temporary memory in the database
session mode="sqlserver"...means session will be stored in the databsae permanently.
No comments:
Post a Comment