Digital Media
Moshell -Spring 98
Lecture 20: Cookies
From S: Chapter 10, pages 290-310
In our Lab 2, we had to maintain the state of the transaction (the information which was entered in the first screen) by putting it into hidden variables and sending it back to the client. The project was deliberately designed to require two screens, to force you to learn how to do this trick. However, there is another way. You can cause a server to retain the state, and simply pass back to the client some kind of unique identifier - like a claim check in a coat-check room (only meaningful if you have lived outside of Florida!)

In the textbook example, rather than using one's own CGI script and reading and writing to a database, a separate cookie server is used.The server is really a process (specified by a Perl script) that always runs. So in effect, it creates a RAM-based temporary database in the form of an associative array.

Query 20.1: What are some of the advantages and disadvantages of this RAM-based cookie store, versus a truly persistent disk-stored database?

There are two approaches described in the book: "temporary cookies" which are handled via hidden variables in the forms being sent to individual customers; and "Netscape persistent cookies" which are handled by Netscape Navigator itself  (and also by Internet Explorer, copy-cat style.)

Temporary Cookies: The essential story is this:

In this first figure, we can see the story being told.

Netscape Persistent Cookies: The essential story here:
 

And here is that elaborate story, in picture form:


Query 20.2: Is there anything that the Netscape Persistent Cookie system can do, (in terms of helping your business to grow and prosper and make money) which the temporary cookie technique cannot do?

Query 20.3: Could you add the persistent cookie-server database concept to the Temporary Cookie scenario? What would be the advantages, or disadvantages of doing such a thing?