none
Delete IE history from C# RRS feed

  • Question

  • Hi,

    I want to delete the IE history from C# code. I found below given solutions and got confused which one is robust and correct to implement. None of these are working for IE 7.

     

    1. Use IUrlHistoryStg2 through interoperability to clear IE history.

    2. Delete WebCacheV01.dat file. 

    You may suggest new solution if that is more appropriate.

    Please suggest.

    Thanks.




    Wednesday, August 1, 2018 10:56 AM

All replies

  • You can call  (with Process.Start)

    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

    which uses IUrlHistoryStg2 + FreeUrlCacheSpaceA

    Wednesday, August 1, 2018 11:34 AM
  • Hi,

    It's not working for Windows Vista with IE 7. 

    Thanks


    Wednesday, August 1, 2018 11:52 AM
  • I had tested on Windows 10 + IE 11

    Otherwise, you can try those 2 Interface/API with Interop

    Wednesday, August 1, 2018 12:17 PM
  • I had tested on Windows 10 + IE 11

    I don't know if FreeUrlCacheSpaceA works on IE7...

    Wednesday, August 1, 2018 12:19 PM
  • Yeah..Its working on Win 10 with IE 11 and not working for Win Vista with IE 7.

    Could you please suggest something for this? 

    Thanks




    Wednesday, August 1, 2018 12:32 PM
  • Hi Sham Developer,

    Thank you for posting here.

    Since I do not have IE7, I do not test the code. But, I test on my Win10 IE11, it works well.

     public enum ShowCommands : int
            {
                SW_HIDE = 0,
                SW_SHOWNORMAL = 1,
                SW_NORMAL = 1,
                SW_SHOWMINIMIZED = 2,
                SW_SHOWMAXIMIZED = 3,
                SW_MAXIMIZE = 3,
                SW_SHOWNOACTIVATE = 4,
                SW_SHOW = 5,
                SW_MINIMIZE = 6,
                SW_SHOWMINNOACTIVE = 7,
                SW_SHOWNA = 8,
                SW_RESTORE = 9,
                SW_SHOWDEFAULT = 10,
                SW_FORCEMINIMIZE = 11,
                SW_MAX = 11
            }
            [DllImport("shell32.dll")]
            static extern IntPtr ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, ShowCommands nShowCmd);
            public static void IEclear3()
            {
                //clear history
                ShellExecute(IntPtr.Zero, "open", "rundll32.exe", " InetCpl.cpl,ClearMyTracksByProcess 1", "", ShowCommands.SW_HIDE);
            }

    Best Regards,

    Wendy


    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.


    Thursday, August 2, 2018 7:24 AM
    Moderator
  • Hum... It is exactly what I posted...

    and OP said it did not work for him.


    • Edited by Castorix31 Thursday, August 2, 2018 8:08 AM
    Thursday, August 2, 2018 8:08 AM
  • Hi Castorix31,

    Sorry, I just provide a complete code sample for reference. I try to create the same system. But there is no template of Vista in VMAS.

    Best Regards,

    Wendy


    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.

    Friday, August 3, 2018 7:20 AM
    Moderator