Why Use Session Management?

Session management is a means by which a user’s identity can be preserved between requests. Session management in a Web environment works by passing an identifier to the user with a response, and then having the user pass back that identifier with subsequent requests to keep track of his session. This identifier can then be used to correlate the user with information relating to his activity. For example, if the user is shopping on your site, you can keep track of all of the items he’s placed in his shopping basket using session management.

As you’ve already learned, HTTP is a connectionless protocol. When a user requests a Web page, the server sends the page and forgets that the browser ever asked. If a Web site ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.