我想使用以下代码清除 IE 中的所有 cookie:
public void ClearCookie()
{
string[] Cookies =
System.IO.Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
foreach (string currentFile in Cookies)
{
try
{
System.IO.File.Delete(currentFile);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
但是当我运行时,出现一个带有内容的消息框:进程无法访问文件:C:\User...\Microsoft\Windows\Temporary InterNet Files\counter.dat' 因为它正在被另一个进程使用 我该怎么办解决这个问题???