ASP Tutorials - Herong's Tutorial Examples - v5.10, by Dr. Herong Yang
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.
Table of Contents