ONE Active Server Pages Product Home Page Developer Site Version


Managing User Sessions

Communication between a browser and a Web server uses the HTTP protocol. This protocol is stateless, meaning that no information is retained when a user goes from one page to another. In a real-world application, it is usually necessary to retain information between pages visited by the same user. The use of an application by a single user is called a session.

Sun ONE Active Server Pages includes the built-in Session object for retaining session information. When a new session starts, an instance of the Session object is created automatically. You can assign variables and object instances to session variables so that they are available to all pages of the application visited by the same user.

The global.asa file can contain the following handlers for two session-level events: Session_OnStart and Session_OnEnd, which are described later in this topic. These subroutines are automatically executed the first time a user accesses an ASP page within the application. Sessions exist until one of the following occurs:

In this section:

Turning Session Tracking On and Off

ASP Session_OnStart Event

ASP Session_OnEnd Event