

ASP ADVANCED

In
this chapter, you learn how to work with sessions.
You learn how to use session collections, properties, methods, and
events. You also learn how to
read and create cookies. Finally,
some methods are discussed for retaining state without cookies.
What
are sessions? A session is
something that starts the moment a user requests a page from your Web site
and ends soon after the user leaves.
Each visitor to your web site is given an individual session.
Sessions
Can be used to store a visitor's preferences.
For example, does the visitor prefer that Web pages have a green
background or a blue background? Does
the visitor have a strong hostility toward frames?
Does the visitor prefer to view a text-only version of your Web
site? These preferences can
be tracked by using sessions.
Sessions
can also be used to create virtual shopping carts.
Whenever a visitor selects an item to buy at your Web site the item
can be added to a shopping cart. When the user is ready to leave, he or
she can purchase everything in the shopping cart at once.
All the information about the items in the shopping cart can be
stored in a session.
Finally,
sessions can be used to keep track of the habits of your visitors.
In the same way in which environmentalists use tracking devices to
record the roaming habits of the great white shark, you can use sessions
to track the movements of your visitors as they roam from page to page.
This information can be used for advertising purposes, to improve
the design of your Web site, or simply to satisfy your curiosity.
|