How can I achieve this ? RRS feed

  • Question

  • I want to create a winforms application to import cache in a browser, delete browser history and cache . Do we have any built in C# libraries by which we can achieve this ? Please guide.
    Monday, April 13, 2020 7:35 PM

All replies

  • Hello,

    Each browser has their own API to do this and many disallow this for security reasons.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Monday, April 13, 2020 8:56 PM
  • Hi,

    Thank you for posting here.

    Here is an example to delete chrome history.

    using System;
    using System.Data.SQLite;
    using System.IO;
    namespace ConsoleApp3
    	class Program
    		static void Main(string[] args)
    			string chromeHistoryFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
    			chromeHistoryFile += @"\Google\Chrome\User Data\Default\History";
    			if (File.Exists(chromeHistoryFile))
    				using (var connection = new SQLiteConnection("Data Source=" + chromeHistoryFile + ";Version=3;New=False;Compress=True;"))
    					using (SQLiteCommand command = new SQLiteCommand("delete from urls", connection))
    			Console.WriteLine("Press any key to continue...");

    You can use the following sql statement to view more information about the browser.

    select * from sqlite_master where type='table';

    It should be noted that when you execute these codes, chrome must be closed.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 14, 2020 5:23 AM