Session variables allow developers to store visitor information by setting a variable that is accessible to the application for the duration of a visitor's session.
Session variables have the following traits:
- Unless specified otherwise, session variables expire 20 minutes after a visitor leaves the site.
- Session variables expire if no activity is detected on the site for 20 minutes by that specific site visitor. They also expire if the visitor quits out of their web browser.
- In order for session variables to work, it's necessary that the visitor's browser is set to accept cookies.
- It's necessary that all the pages for the site are located within a single directory on the web server.
- Information stored in session variables is site visitor specific. Different site visitors cannot access each other's session variable information.
Typically, developers capture the data for the session variables by having a visitor fill out a form in the web application. The session variable is set to the value of a form field. The examples in this TechNote use information from a form element to set the value of a session variable.
For all server models except ASP.NET, Dreamweaver has a menu-driven feature to write session variables to a page after a session variable is created. However, Dreamweaver doesn't provide a menu-driven feature to assign a value to a session variable (also known as instantiating a session variable). It's necessary to assign a value to a session variable manually within the source code.