Maintaining Session State With ASP - The Session Object (Page 2 of 5 )
The session object is used to store variables for each specific visitor to your web site. These variables could represent anything from how many pages the user has viewed to their login details. A session is defined as the time from when the user visits your site to the time when he leaves – session variables die after a visitor closes their web browser (i.e. they are not persistent).
Variables stored in the session object are available to all ASP pages on that particular web site. Common information stored in session variables includes name, id, and personalization preferences. The server creates a new session object for each new user and destroys the session object when the session expires.
A session object is specific for every user and varies from user to user. IIS will maintain these variables when the client moves across pages within the site.
SessionID: A long number that returns the session identifier for this client.
Timeout: An integer that specifies a timeout period in minutes. If the client doesn't refresh or request any page from your site within this timeout period then the server ends the current session. If you do not specify any timeout period then the default timeout period of 20 minutes is used.
Abandon: Destroys the current session object and releases its resources, meaning that if the client requests any page from your site after the Session.Abandon method has been called then a new session will be started.
Session_OnEnd: This event occurs when the session is abandoned or times out for a specific user.
Session_OnStart: Occurs when a new session is started. All ASP objects are available for you to use. You can define your session wide variables here.
You can store any value you like in the session object. Information stored in the session object is available for the entire session and has "session scope". The following script demonstrates how two types of variables are stored: