DD Sessions

esse quam videri
Jump to: navigation, search


Sessions

Every web application has a collection of objects called a session. Each browser is assigned a unique cookie that is used to identity the SessionID of the connection.

The session collection can hold any object and remain until a session times out. A session times out when the web server does not receive a request from a client for longer than the timeout period (deafult 20 mins)

session variables are set just like any other Collection. When you retrive an item form the collection you need to cast it back to it's original type (string casts are implict in c# so you really don't have to cast a string).

Session["LogonName"] = "test";

string strLogonName = (string)Session["LogonName"];