Discussion:
clearing IE cache
(too old to reply)
Manish
2004-11-17 03:30:01 UTC
Permalink
I found the following KB article to clear IE cache. However the code in this
article also clear the cookies. I do not want to clear the cookies. Is there
a way to prevent clearing the cookies?

http://support.microsoft.com/default.aspx?scid=kb;en-us;326201
Stephen Sulzer
2004-11-23 07:29:57 UTC
Permalink
The sample code uses FindFirstUrlCacheEntry which enumerates through all the
entries in the cache. If you wish to exclude cookie entries, then you can
use FindFirstUrlCacheEntryEx which allows the caller to specify a filter
indicating what kind of cache entries to retrieve.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/findfirsturlcacheentryex.asp?frame=true

The _CACHE_ENTRY dwFilter values are defined in wininet.h.

So, roughly, you would modify the sample code to define the appropriate
filter flag constant:

// URLCACHE_FIND_DEFAULT_FILTER - COOKIE_CACHE_ENTRY
const int FindFilterNoCookies = 0x0020003D;

and change the code to use FindFirstUrlCacheEntryEx:

enumHandle = FindFirstUrlCacheEntryEx(null, 0,
FindFilterNoCookies,
0, // 0 GroupId
cacheEntryInfoBuffer,
ref cacheEntryInfoBufferSizeInitial,
IntPtr.Zero, // null LPVOID
IntPtr.Zero, // null LPDWORD
IntPtr.Zero); // null LPVOID

I haven't tested this code, but I hope this helps.

Stephen
Post by Manish
I found the following KB article to clear IE cache. However the code in this
article also clear the cookies. I do not want to clear the cookies. Is there
a way to prevent clearing the cookies?
http://support.microsoft.com/default.aspx?scid=kb;en-us;326201
Continue reading on narkive:
Loading...