且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C#中使用WebBrowser控件清除浏览历史记录

更新时间:2023-02-08 15:14:46

Internet临时文件

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 8)

饼干()

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 2)

历史()

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 1)

表(数据)

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 16)

密码

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 32)

删除(全部)

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 255)

全部删除 - 也删除由加载项存储的文件和设置。

  System.Diagnostics.Process.Start(RUNDLL32.EXE,InetCpl.cpl,ClearMyTracksByProcess 4351)

I want to clear the browsing history of a WebBrowser control in C# after the WebBrowser completes its browsing.

This is my code:

try
{
    foreach (string sr in File.ReadAllLines("link.txt"))
    {
        webBrowser1.Navigate(sr);
        webBrowser1.ScriptErrorsSuppressed = true;
    }
    while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
    {
        Application.DoEvents();
    }                               
}
catch(Exception)
{
    MessageBox.Show("Internet Connection not found","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
    this.Close();
}

Temporary Internet Files

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 8")

Cookies()

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 2")

History()

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 1")

Form(Data)

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 16")

Passwords

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 32")

Delete(All)

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 255")

Delete All – Also delete files and settings stored by add-ons

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 4351")