Difference between revisions of "DD Sessions"

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

Revision as of 18:22, 25 January 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).

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

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