I have an application hosting the webbrowser control which clears the cache (regularly) using the code example provided my microsoft: http://support.microsoft.com/kb/262110
I am noticing however that after sometime the cache get corrupted or not working properly (requests that should be out of cache - are called over and over again.
When I run the following command, the application starts running normally. system('RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8')
Are the two the same, or is the code lacking something?
In IE9 I ran InetCpl.cpl,ClearMyTracksByProcess 8 and it did not remove a thing so looks like MS has moved the goal posts again.
Shown below is some very nice code I picked up that should work in IE7 but if you want code that does the trick on win7 and IE8/9 then click my name
public static class ClearMyTracks {
/*
* To clear IE temporary Internet files – ClearMyTracksByProcess 8
* To clear IE browsing cookies – ClearMyTracksByProcess 2
* To clear IE browsing history – ClearMyTracksByProcess 193 (ALSO deletes add on history)
* To clear IE form data- ClearMyTracksByProcess 16
* To clear IE remembered passwords for filling web login forms-ClearMyTracksByProcess 32
* To clear or delete all IE browsing history – all of above!- ClearMyTracksByProcess 255
* To clear IE Tracking- ClearMyTracksByProcess 2048
* Preserve Favourites use 8192
* To clear IE Downloaded Files- ClearMyTracksByProcess 16384
* http://www.howtogeek.com/howto/windows/clear-ie7-browsing-history-from-the-command-line/
*/
public enum ClearFlags {
DeleteCookies = 2,
DeleteHistoryFiles = 8,
DeleteFormData = 16,
DeletePasswords = 32,
DeleteHistory = 193,
DeleteALLHistory = 255,
DeleteTrackingInfo = 2048,
PreserveFavourites = 8192,
DeleteDownloadHistory = 16384,
DeleteEverything = 22783
};
public static void IEClearHistory(bool PreserveFavs, bool TempFiles, bool Cookies, bool History, bool form, bool passwords, bool downloads) {
uint mask = 0;
if (PreserveFavs)
mask |= (uint)ClearFlags.PreserveFavourites;
if (TempFiles)
mask |= (uint)ClearFlags.DeleteHistoryFiles;
if (Cookies)
mask |= (uint)ClearFlags.DeleteCookies;
if (History)
mask |= (uint)ClearFlags.DeleteHistory;
if (form)
mask |= (uint)ClearFlags.DeleteFormData;
if (passwords)
mask |= (uint)ClearFlags.DeletePasswords;
if (downloads)
mask |= (uint)ClearFlags.DeleteDownloadHistory;
if (mask != 0)
System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess " + mask.ToString());
}