Session Variables
 
 
|Session
|Resources
  1
 
Session
A session starts the moment a user requests a page from the web site and ends after the user leaves the site. The HTTP protocol works whenever a user makes a request, the server supplies a response. After a server has finished responding to a request, the server can't continue to identify the browsers that made it. From the perspective of a Web server, each new request is made by a new individual. This is why the HTTP Protocol is called a stateless protocol. Sessions were introduced to fix this problem. By using sessions, one can store information about a user over multiple Web Pages.
   
Session Variables
A session variable is used to retrieve the content of a child of the root, if it needs to be applied directly, as a condition of the UDM.
One can use the session variable in a predicate and then use that predicate on the child nodes as applicable, achieving the same effect.
Separate copies of a session variable are created for each visitor to the web site.
A session variable, unlike the normal variable, persists until the user leaves the web site.
It is important to understand that session variables exist only in relation to a particular user. The values assigned to  session variables in  one user session don't affect the values of the session variables in another user session, i.e. the value of a session variable is not shared  among multiple users. Thus conflicts cannot arise because no two users will ever have access to the same session variable.
Most session variables are stored in a collection of the Session object named Contents.
   
Identifying a Session
Each user is assigned a separate session ID.
This is the unique Identifier which is created when the user session is first created and persists as long as the user remains on the web site.
When different users retrieve the page, a different session Id will be displayed for each. However, if the same user retrieves the page multiple times, the same session ID should be displayed.
   
Controlling when sessions end
The server assumes that if someone hasn't requested or refreshed a page for a pre-specified period, that person has left the site and therefore and times out that user's session. The period is defined via an option during site creation.
This strategy enables the server to recover resources that it has been using to track the user's session.
The user can control the maximum amount to time for which a user is allowed to be inactive before a session times out.
When a user session times out and the user makes a new request, the server treats the user as a new user. The server now creates a new session, and all the old session information is lost.
                                                                                                                                             
  1