It all depends on how many sessions you expect to have open at a given time. True, IIS will write a single Session cookie to every browser to maintain session state. However, from there, it's your decision to keep additional data in memory on the server (Session Variables) or in cookies on the visitor's computer. While cookies can free up memory on the server, I believe it slows down requests because of the round trips required to read from cookie files.
Here's the two most critical questions in determining how to maintain a shopping cart session with your visitors.
#1: How long do you want a shopping cart session to remain active if the visitor simply closes the browser window or walks away in the middle of a shopping trip.
#2: How many visitors (MAX) do you envision during that specific period of time. The time being your answer from question 1.
#3: What is it that you want to store in your session or cookie variables. If you're thinking about storing the shopping cart in either, I wouldn't recommend it. I just finished a shopping cart recently and this is what that particular individual did.
They had two tables in their database. One was for individuals
user and the other was for shopping cart items
cart. When a visitor would come into the site, the server would check a single cookie for a
userid on the visitor's computer. If found, that relieved the visitor from identifying him/herself with the website. That was the only cookie stored on the computer. If the visitor did not have a cookie, then one was written after the visitor supplied his/her information on checkout.
The shopping cart table had a sessionID field, inventoryID field, and quantity field. As soon as the visitor placed one item in the cart, a record was appended to the table using
Request.ServerVariables("HTTP_COOKIE"
as the sessionID value. This is the IIS session ID which is unique for every visitor and although this is the value that IIS writes to the browser as the Session cookie, it does not require a round trip to get the value. We had a
DELETE method in the global.asa file that removed records from the shopping cart table when an IIS session terminated or timed out. We also removed items from the shopping cart table upon checkout.
That was it. One Session variable, which in this case is the single session variable that IIS creates when a browser requests the first page from your web site. And a single cookie variable so visitors did not have to re-enter personal information every time they came to the site.
Everything else was stored in database tables.
Hope this helps.
ToddWW