当前位置:首页> 编程笔记> C#开发
关键字
文章内容
C#关于清除IE浏览器缓存
 
 
修改时间:[2012/06/07 22:49]    阅读次数:[1142]    发表者:[起缘]
 

代码如下:

using System.IO; 
...
void clearIECache()
{
   ClearFolder (new DirectoryInfo (Environment.GetFolderPath
      (Environment.SpecialFolder.InternetCache)));
}
 
void ClearFolder (DirectoryInfo folder)
{
   foreach (FileInfo file in folder.GetFiles())
      { file.Delete(); }
   foreach (DirectoryInfo subfolder in folder.GetDirectories())
      { ClearFolder(subfolder); }
}
 
public static void Main( )
{
   new Test().clearIECache ();
}