通过“C#”清除临时Internet文件

我在windows application.i中使用webbrowser控件正在webbrowser控件中查看url内容。 这里url内容值存储在用户机器的临时Internet文件中。

当我点击我的表单中的关闭按钮时,我正在以编程方式删除临时Internet文件。 它工作正常。 但在删除过程中,“消息框出现并说删除临时Internet文件”。

在这里我不想在删除期间显示该对话框。 下面是删除用户机器临时文件的代码。

怎么处理这个..

void DeleteBrowserTempFile() { string args = ""; args = ("InetCpl.cpl,ClearMyTracksByProcess 8"); System.Diagnostics.Process process = null; System.Diagnostics.ProcessStartInfo processStartInfo; processStartInfo = new System.Diagnostics.ProcessStartInfo(); processStartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\Rundll32.exe"; if ((System.Environment.OSVersion.Version.Major >= 6)) { // Windows Vista or higher processStartInfo.Verb = "runas"; } processStartInfo.Arguments = args; processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; processStartInfo.UseShellExecute = true; try { process = System.Diagnostics.Process.Start(processStartInfo); } catch (Exception ex) { Utilities.WriteErrorLog(ex); } finally { if (!(process == null)) { process.Dispose(); } } } 

有没有其他方法来实现这一点..需要你的建议与例子

问候

Anbuselvan

尝试Microsoft建议: http : //support.microsoft.com/kb/326201