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?
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....
Even though another program isn't using them...
Take a look at this:
http://www.codeproject.com/csharp/ponta.asp?df=100&forumid=67589&exp=0&select=897325
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?
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...
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?