A version of this page is also available for

Windows Embedded CE 6.0 R3


This function retrieves the cookie for the specified URL.


BOOL InternetGetCookie(
  LPCTSTR lpszUrl,
  LPCTSTR lpszCookieName, 
  LPSTR lpCookieData, 
  LPDWORD lpdwSize


  • lpszUrl
    [in] Address of a string that contains the URL to get cookies for.
  • lpszCookieName
    [in] Address of a string that contains the name of the cookie to get for the specified URL. This has not been implemented in this release.
  • lpCookieData
    [out] Address of the buffer that receives the cookie data. This value can be NULL.
  • lpdwSize
    [in, out] When the function is called, the address of an unsigned long integer variable that specifies the size of the lpszCookieData buffer. On return, if the function succeeds, the buffer receives the amount of data copied to the lpszCookieData buffer. If lpszCookieData is NULL, this parameter receives a value that specifies the size of the buffer necessary to copy all the cookie data.

Return Value

Returns TRUE if successful, or FALSE otherwise.


This function does not require a call to InternetOpen. To retrieve cookies, it checks for both session cookies and persistent cookies. Session cookies, which do not have an expiration date, are stored in memory and are available only to the process in which they were created. Persistent cookies, which have an expiration date, are stored in the location specified in the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders registry key. The default location is Windows\Profiles\Guest\Cookies. Because the rules for creating cookie files are internal to WinInet functions and are subject to change, your application should always call InternetGetCookie, rather than attempt to access cookie files directly.


Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also


WinInet Functions