Using URL Variables

One of the most common methods of state management is the use of a URL variable for the unique identifier. In fact, most state-management mechanisms use cookies, URL variables, or some combination of the two.

In order to use a URL variable to identify the client, you must make sure that the HTML generated from your application uses this variable in all URLs that the user will use to navigate your site. Most Web applications will use one of two primary methods of navigation—form submission buttons and links—so I will focus on these approaches.

For links, the HTML you need to output is something like the following:

<a href=”/example.php?unique_id=12345”>Click Here</a> 

Although the only dynamic information in this example ...

Get HTTP Developer’s Handbook 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.