Share via


CInternetSession::GetCookie

static BOOL GetCookie( LPCSTR pstrUrl**, LPCTSTR** pstrCookieName**, LPTSTR** pstrCookieData**, DWORD** dwBufLen );

static BOOL GetCookie( LPCSTR pstrUrl**, LPCTSTR** pstrCookieName**, CString&** strCookieData );

Return Value

Returns TRUE if successful, or FALSE otherwise. If the call fails, call the Win32 function to determine the cause of the error. The following error values apply:

  • **ERROR_NO_MORE_ITEMS ** There is no cookie for the specified URL and all its parents.

  • ERROR_INSUFFICIENT_BUFFER The value passed in dwBufLen is insufficient to copy all the cookie data. The value returned in dwBufLen is the size of the buffer necessary to get all the data.

Parameters

pstrUrl

A pointer to a string containing the URL.

pstrCookieName

A pointer to a string containing the name of the cookie to get for the specified URL.

pstrCookieData

In the first overload, a pointer to a string containing the address of the buffer that receives the cookie data. This value can be NULL. In the second overload, a reference to a CString object to receive the cookie data.

dwBufLen

The variable specifying the size of the pstrCookieData buffer. If the function succeeds, the buffer receives the amount of data copied to the pstrCookieData buffer. If pstrCookieData is NULL, this parameter receives a value that specifies the size of the buffer necessary to copy all the cookie data.

Remarks

This member function implements the behavior of the Win32 function , as described in the Platform SDK.

In the second overload, MFC retrieves the cookie data into the supplied CString object.

See Also   CInternetSession::GetCookieLength, CInternetSession::SetCookie