以编程方式清除 IE 缓存与 InetCpl.cpl,ClearMyTracksByProcess

发布于 2024-10-21 07:31:34 字数 331 浏览 4 评论 0原文

我有一个托管网络浏览器控件的应用程序,它使用我的微软提供的代码示例(定期)清除缓存: http://support.microsoft.com/kb/262110

但是我注意到,一段时间后缓存损坏或无法正常工作(应该不在缓存中的请求 - 被一遍又一遍地调用。

当我运行以下命令时,应用程序开始正常运行。 system('RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8')

两者是否相同,或者代码是否缺少某些内容?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

趁微风不噪 2024-10-28 07:31:34

在 IE9 中,我运行了 InetCpl.cpl,ClearMyTracksByProcess 8,它没有删除任何东西,所以看起来 MS 再次移动了球门柱。

下面显示的是我挑选的一些非常好的代码,应该可以在 IE7 中运行,但如果您想要在 win7 和 IE8/9 上运行的代码,请单击我的名字

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());
}

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());
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文