Setting cookies in your HTTP headers

This means that you set cookies by including a Set-Cookie line somewhere in your HTTP headers, and you receive a cookie by examining any Cookie header sent to your server. Actually, if you are running a CGI script, the server will pass the cookie information along to the script in the form of an HTTP_COOKIE environment variable. Depending on how you are serving your pages, there is probably a shortcut for doing this.

If you are using Perl, there is a CGI::Cookie module available from:

[external link] http://www.perl.org/

Using Perl's CGI::Cookie module, you could retrieve cookies with the fetch CGI::Cookie command, create them with new CGI::Cookie and set them using a print "Set-Cookie: $mycookie" command.

If you are using Active Server Pages, you would use the Request.Cookies() and Response.Cookies() functions to retrieve and set cookies. There is a very good chance you are using these already. Ask your local Web guru for more information.