34.8. Understanding Cookies

The next state management technique we'll examine is the persisting of data within a cookie, which is often realized as a text file (or set of files) on the user's machine. When a user joins a given site, the browser checks to see whether the user's machine has a cookie file for the URL in question and, if so, appends this data to the HTTP request.

The receiving server-side web page can then read the cookie data to create a GUI based on the current user preferences. I'm sure you've noticed that when you visit certain of your favorite web sites, they somehow "just know" the sort of content you wish to see. The reason (in part) may have to do with a cookie stored on your computer that contains information relevant to ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth 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.