Posted by : Sudhir Chekuri Saturday, 5 October 2013

Session State - ASP.NET State Management Technique

Session object is mainly used to store the data specific to a user and pass it from one page to another page in
your applications.

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.
You 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.


Leave a Reply

Subscribe to Posts | Subscribe to Comments

Followers

Total Pageviews

Powered by Blogger.

Blog Archive

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -