~inc:header.inc~

Cookies

Cookies are small text strings that are stored in the browser. These strings are set by the server, and returned as parameters for all future requests until the session ends. They can be used to store session state information, and are valid until the browser is closed.

Name:~cookiename~
Favorite:~cookiefav~

There are numerous uses for cookies. In this example, the user's name is stored as a cookie. All future page loads will show this name in the top left corner, as well as in the box above.

First Name:
Favorite:

Cookies are set by storing null-terminated name/value pairs in the HTTP connection internal data. The number of cookies is also stored. The values can be set in either TCPIP_HTTP_GetExecute or TCPIP_HTTP_PostExecute.

Cookies are retrieved in the same manner as GET form arguments. They are stored in the HTTP connection internal data and can be located using the TCPIP_HTTP_ArgGet functions. Since they are stored in the same array as GET arguments, the total length of cookies and variable arguments cannot exceed the 80 byte buffer limit.

Exercise: Set a second cookie named fav with the value of the favorite field and have it displayed in the gray box above.

~inc:footer.inc~