Using WinINet
InternetGetCookie
and InternetSetCookie
functions, it's pretty straightforward to get and set cookie inside the application which makes a web request through WinINet
.
However, I could not so far find a way to clear cookie.
Calling InternetSetCookie
with blank data (either L""
or NULL
) does not help (tried both with and without specifying the cookie name).
Tried FindFirst/NextUrlCacheGroup
, DeleteUrlCacheGroup
, and also FindFirst/NextUrlCacheEntry
, DeleteUrlCacheEntry
combinations. Still no luck.
Any ideas?
Kei,
I had the same problem and a colleague of mine just helped me solve it. You need to call:
InternetSetOption(0, 42, NULL, 0);
The answer is taken from here.
This did the trick for my app and I hope it will work for you also.
Edit:
The "42" value in the function call stands for the "INTERNET_OPTION_END_BROWSER_SESSION" flag, which "Flushes entries not in use from the password cache on the hard disk drive. Also resets the cache time used when the synchronization mode is once-per-session. No buffer is required for this option. This is used by InternetSetOption." ( http://msdn.microsoft.com/en-us/library/aa385328%28v=vs.85%29.aspx )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With