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 current HTTP connection data buffer. The number of cookies that are set is also stored. They can be set in either getExecute or postExecute.

Cookies are retrieved in the same manner as GET form arguments. They are stored in the current HTTP connection data buffer and can be located using the TCPIP_HTTP_NET_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.