DD Sessions

esse quam videri
Revision as of 18:22, 25 January 2016 by Jeff (talk | contribs) (Text replacement - "<csharp>" to "<syntaxhighlight lang="csharp" line="1" >")
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).

<syntaxhighlight lang="csharp" line="1" > Session["LogonName"] = "test";

string strLogonName = (string)Session["LogonName"]; </csharp>