Application and session variables work similarly, each having a dictionary of objects. Keys identify each object in the dictionary. The keys are normally text strings that give a name to each object in the dictionary. For example, I might have a user ID object and I might name it UserId. The following simple example shows how an integer value of 12 could be stored in a session variable named UserId:
// C# Session[“UserId”] = 12; ' VB Session(“UserId”) = 12
It is just as easy to set a session variable to contain a string. The following examples show how to set session variables in C# and VB to a string containing the name John Doe:
// C# Session[“UserName”] = “John Doe”; ' VB Session(“UserName”) = “John ...