First of all, let's talk about how cookies work. Cookies are basically just variables, and can be VERY useful in state management, user identification, etc. Cookies are set and retrieved via the HTTP headers. To create a cookie, the server includes a "Set-Cookie" command in the header. After a cookie is set, the client will pass the cookies and their values to the server in the header of every HTTP request. More details of what to send and what is received can be found at http://www.netscape.com/newsref/std/cookie_spec.html
Below find source code for a CCookie class, with member functions GetCookie, SetCookie, and EnumCookies; as well as a sample ISAPI project.
To use the sample project, simply build it, and place ISAPICookies.DLL in your WWWROOT directory (make sure you have execute access enabled for that directory); then direct your browser to http://localhost/ISAPICookies.DLL
Feel free to contact me with any questions or comments.