I have been googling for hours and trying to figure this out, and I just can\'t. I have 1 webbrowser control on a form, webbrowser1.
Once I load a page, say google.
use navigate(url,4) 0x4=noCache
flag
Add following meta tag in your pages
<meta http-equiv="cache-control" content="no-cache">
In the .navigate method, you pass the number 2 (the no history flag) but this will only kill history for that navigation, won't kill history for when you follow links. If you want to kill history for links that are clicked on, then you can intercept navigation during beforenavigate event, cancel the navigation by setting cancel = true and then using the URL provided by the event, re doing the navigation using .navigate with the flag set to 2 again (the no history flag).
As far as other cache items like cookies, the flags don't work (though they may have implemented this in current versions)... Soto kill all cache items you actually need to programmatically do this outside of the web browser control by querying user cache using other Apis and deleting it, perhaps during document complete event or when browsing is done.
Also be aware that if you kill history using web browser control, the web browser controls .goback method will not work (as it uses the same history unfortunately, and doesn't keep another history list in memory)... So when doing a goback, it will act like there was nothing to go back to :/.
Let me know if you need more help.
C# WebBrowser control: Clearing cache without clearing cookies
You could try adding a random number or guid in the url as a parameter. Such as:
var url = "http://google.com";
webBrowser.Navigate(url + "?refreshToken=" + Guid.NewGuid().ToString());
It's not elegant, but it works. Hope it helps.
This page shows how to clear some temp file, read it. I also have this issue, but when .refresh() is not useful to me as it doesnt trigger documentcomplete event. So when I wish to reload, I simply use .navigate()
and before navigation I call the
System.Diagnostics.Process.Start("rundll32.exe","InetCpl.cpl,ClearMyTracksByProcess 8")
in order to clear cache.