Cookie FunctionsCookie Functions*
*



Contents  *



Index  *Topic Contents
*Previous Topic: HTTP Sessions
*Next Topic: Caching

Cookie Functions

Under HTTP protocol, a server or a script uses cookies to maintain state information on the client workstation. The Win32 Internet functions have implemented a persistent cookie database for this purpose. The Win32 Internet cookie functions are used to set cookies into and access cookies from the cookie database.

The Win32 Internet functions InternetSetCookie and InternetGetCookie manipulate cookies. The caller of these functions should be familiar with cookies as outlined in ftp://ds.internic.net/internet-drafts/draft-ietf-http-state-mgmt-*.txt. Please note that the implementation of these functions is evolving; be cautious when using them.

Using Cookie Functions

Two functions allow an application to create or retrieve cookies in the cookie database.
Function Description
InternetGetCookie Returns cookies for the specified URL and all its parent URLs.
InternetSetCookie Sets a cookie on the specified URL.

Getting a cookie

InternetGetCookie returns the cookies for the specified URL and all its parent URLs.

No call to InternetOpen is required to use this function. InternetGetCookie looks for cookies with no expiration dates in the windows\cookies directory and searches for unexpired cookies that are not written to any files in memory.

Setting a cookie

InternetSetCookie sets a cookie on the specified URL.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.