xRuntime

How can I do this I've tried a bunch of foreach statements, even tried some Win32 stuff, and I havent been able to do it...



Re: Internet Explorer Extension Development Clear IE History From C#

ahmedilyas

how did you try to remove the history did you delete all the files in the History folder programmatically using the Environment.GetFolderPath(Environment.SpecialFolder.History) path




Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

Yes, and that doesn't work. The only file it recognizes is desktop.ini.
I've also tried to delete the entire folder. That didn't work either.
I also tried deleting the path "Today" and "History", as well as all files in the folder method, that didn't work either (i figured if in Windows Explorer I could type those and be led to the folder I could use it in C# as well)





Re: Internet Explorer Extension Development Clear IE History From C#

ahmedilyas

the history folder is hidden. I'm able to retrieve all the contents, well, the dat files which represent in Windows the timings (Today, Friday, Thursday....2 weeks ago etc...)

string[] theFiles = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.History), "*", SearchOption.AllDirectories);

You could try deleting the file, going through each item in the array[] and doing a System.IO.File.Delete()

does this help






Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

I didn't have the search option part, and that's probably why it didn't work.

Thanks.

But now I'm encountering another problem, where on form_load the files are deleted, even though I have it clearly put in the webbrowser_navigated event, and also, when the webbrowser navigates, the history files arent deleted....





Re: Internet Explorer Extension Development Clear IE History From C#

ahmedilyas

you sure you haven't perhaps entered a url to navigate to on the form_load or perhaps by default in the webbrowser control when loading the application




Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

I have set the documenttext property, but I haven't navigated the webbrowser.





Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

Actually, the code didn't work. The file(s) that contain the history are not accessible because another program is using them....

Even though another program isn't using them...





Re: Internet Explorer Extension Development Clear IE History From C#

ahmedilyas

It would be Windows itself :-)




Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

Then how would I clear history How does IE Options and IE do it





Re: Internet Explorer Extension Development Clear IE History From C#


Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

Thanks. I'll try this out, and report back if I can get it to work.





Re: Internet Explorer Extension Development Clear IE History From C#

Peca55

Hi xRuntime

Your problem interest me too. Looked codeproject article and there was a very interesting paragraph, I quote it here:

"To clear history on a per-user basis, call the ClearHistory method on the UrlHistoryWrapperClass object. This method will delete all the history except today's history, and Temporary Internet Files of your browser stores copies of all the pages you visit when you are surfing on the Internet."

So the project is useless for me. Driving toward the solution, I firstly tried to figure out, where history settings are keeped. I had choosed that browser will not keep a ¡°History¡± at all by selecting "0" in the box next to the text "Days to keep pages in History". So I changed it to "7" (one week). After doing that I digged in the registry for looking for it's global effects.

Here is hives of my interest:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache]

"FreshnessInterval"=hex:80,f4,03,00

"CleanupFactor"=hex:19,00,00,00

"CleanupTime"=hex:00,00,00,00

"CleanupInterval"=hex:80,51,01,00

"DebugFlag"=hex:ff,ff,00,00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths]

"Paths"=hex:04,00,00,00

"Directory"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\

  74,00,25,00,5c,00,54,00,65,00,6d,00,70,00,6f,00,72,00,61,00,72,00,79,00,20,\

  00,49,00,6e,00,74,00,65,00,72,00,6e,00,65,00,74,00,20,00,46,00,69,00,6c,00,\

  65,00,73,00,00,00

"Size"=hex:24,01,00,00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Special Paths]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Special Paths\Cookies]

"Directory"=hex(2):25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,\

  4c,00,45,00,25,00,5c,00,43,00,6f,00,6f,00,6b,00,69,00,65,00,73,00,00,00

"CachePrefix"="Cookie:"

"CacheLimit"=hex:00,04,00,00

 

Now I know my next stop:

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Special Paths\History]

@="Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Url History"

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Url History]

"DaysToKeep"=dword:00000014

"CacheLimit"=hex:00,02,00,00

"Directory"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\

  74,00,25,00,5c,00,48,00,69,00,73,00,74,00,6f,00,72,00,79,00,00,00

"CachePrefix"="Visited: "

But, looking "DaysToKeep" show 20 days, albeit I have changed it to be one week. Something peculiar is going on with IE7+ and Vista RC1 registry. Is that value used by newly created user account Where is the real value of DaysToKeep for the current user Is it burried inside the per user cache file Do I need to set "CacheLimit to 0 - effectively to purge the history






Re: Internet Explorer Extension Development Clear IE History From C#

xRuntime

I have 0 set as my setting and yet it still keeps history.

Also, I haven't tried the codeproject thing, and good thing I didn't beceause it doesn't even do what I need it to do...





Re: Internet Explorer Extension Development Clear IE History From C#

Peca55

Not yet found any solution, but found interesting note in the KB 322916 and it may be applicable even today:

¡±The Index.dat file is never resized or deleted. Clearing the Internet Explorer history by clicking the Clear History button on the General tab in the Internet Options dialog box does not change the size of the Index.dat file. Also, setting the Days to keep pages in history value to 0 (zero) on the General tab does not change the size of the Index.dat file. The pre-allocated space in the Index.dat file increases Internet Explorer performance.¡±

So the ordinary deletion does not work here and explains why you in the first place had no luck by trying to delete IE history. By the way, the SpecialFolder "History" is <JUNCTION> type directory, what you can't ever delete. (...oops, you can allways format your hard disk and install Linux with Opera browser)

My IE index.dat files are found from directories:

    C:\Users\Peca\AppData\Roaming\Microsoft\Internet Explorer\UserData
    C:\Users\Peca\AppData\Roaming\Microsoft\Internet Explorer\UserData\Low

The index.dat file version is "Client UrlCache MMF Ver 5.2". So, who know the internal structure of that file