Partager via


InternetSetCookieEx

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function creates a cookie associated with the specified URL. This function extends the functionality of InternetSetCookie by identifying third-party cookies.

Syntax

BOOL InternetSetCookieEx( 
  LPCTSTR lpszUrl,
  LPCTSTR lpszCookieName,
  LPCTSTR lpszCookieData,
  DWORD dwFlags,
  DWORD_PTR dwReserved
);

Parameters

  • lpszUrl
    [in] Pointer to a null-terminated string that specifies the URL for which the cookie should be set.
  • lpszCookieName
    [in] Pointer to a string that contains the name to associate with the cookie data. If this parameter is NULL, no name is associated with the cookie.
  • lpszCookieData
    [in] Pointer to the actual data to associate with the URL.
  • dwFlags
    [in] Must be set to INTERNET_COOKIE_THIRD_PARTY. In Windows Embedded CE, any other value will cause function to return FALSE with the error message set to ERROR_INVALID_PARAMETER.
  • dwReserved
    [in] Reserved. Must be set to zero.

Return Value

Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.

Remarks

As with InternetSetCookie, InternetSetCookieEx creates a cookie that is associated with a particular URL. In addition, InternetSetCookieEx verifies that the cookie is a third-party cookie and checks the policy to see if third-party cookies are allowed.

Creating a new cookie may cause a dialog box to appear on the screen if the appropriate registry value, AllowCookies, is set. There is no way to change the registry value from a WinInet function.

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. 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.

Requirements

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

See Also

Reference

WinInet Functions

Concepts

Cookies