Difference between revisions of "DD Sessions"

esse quam videri
Jump to: navigation, search
m (Text replacement - "</csharp>" to "</syntaxhighlight>")
m (Text replacement - "syntaxhighlight lang="csharp" line="1" " to "syntaxhighlight lang="csharp"")
 
Line 9: Line 9:
 
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 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" >
+
<syntaxhighlight lang="csharp">
 
Session["LogonName"] = "test";
 
Session["LogonName"] = "test";
  
 
string strLogonName = (string)Session["LogonName"];
 
string strLogonName = (string)Session["LogonName"];
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 03:20, 9 February 2016


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"];