Tuesday, February 9, 2010

Sessions

A session is a storage unit for data entered by the user and lasts the duration of the users visit the the site.

Session do not have to be declared and can be easily created by the following bit of code:
Session("NameofSession") = value

Sessions do timeout after a period of time that the user is away from the keyboard or idle. To check if the session has timed out of not the following code is used:
If Session.Item("NameOfSession") IsNot Nothing Then
Response.Write(Session("NameOfSession"))
Else
Response.Write("Session NameOfSession does not exist")
End If

No comments:

Post a Comment