What Is Session?

This section describes what is a session - concept to represent a series of HTTP requests and responses exchanged between a specific Web browser and a specific Web server.

What Is a Session?: Session is a concept to represent a series of HTTP requests and responses exchanged between a specific Web browser and a specific Web server. The session concept can be illustrated by the following diagram:

           Server                Browser
ID created  | <-- Request #1  --< |
            | >-- Response #1 --> | ID kept as cookie
            | <-- Request #2  --< | ID send back to server
            | >-- Response #2 --> |
            |     ......          |

The session concept is managed by the server. When the first request comes from a browser on a new host, the server makes the beginning a new session, and assigns a new session ID. The session ID will be then send to the browser as cookie. The browser will remember this ID, and send the ID back to the server in the subsequent requests. When the server receives a request with session ID in them, it knows this is a continuation of an existing session.

When the server receives a request from a browser on a new host (request without a session ID), the server not only creates a new session ID, it also creates a new session object associated with the session ID. See the next section for details.

If there is no subsequent request coming back for a long time for a particular session ID, that session will be timed out. After the session has been timed out, if the browser comes back again with the associated session ID, the server will give an invalid session error.

You will also get an invalid session error, if the browser send a request with a session ID associated with a session which has been terminated by a ASP page with session.Abandon() method.

Last update: 2002.

Table of Contents

 About This Book

 ASP (Active Server Pages) Introduction

 IIS (Internet Information Services) 5.0

 MS Script Debugger

 VBScript Language

 ASP Built-in Run-time Objects

ASP Session

What Is Session?

 Properties and Methods of the "session" Object

 Passing Values between Pages

 HTTP Communication Level Debugging

 HTTP Communication Log Example

 Creating and Managing Cookies

 Managing Sessions with and without Cookies

 scrrun.dll - Scripting Runtime DLL

 Managing Response Header Lines

 Calculation Speed and Response Time

 ADO (ActiveX Data Object) DLL

 Working with MS Access Database

 Guest Book Application Example

 References

 PDF Printing Version