Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable caching in the .NET WebBrowser Control?

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.com, if I use webbrowser1.refresh() or webbrowser1.navigate("google.com"), it's not reloading the page, it has it cached so it's just reloading the cache. This is terribly apparent especially on pages like forums or craigslist.

I need to clear the cache between each refresh (not ideal) or disable caching all together, any ideas? The only things I've found are outdated (vb6 or lower).

like image 899
fMinkel Avatar asked Aug 06 '10 05:08

fMinkel


2 Answers

Add following meta tag in your pages

<meta http-equiv="cache-control" content="no-cache">
like image 198
Ravi Patel Avatar answered Sep 28 '22 03:09

Ravi Patel


You could try to call webbrowser1.Refresh(WebBrowserRefreshOption.Completely). It should refresh the page and show the latest version, something like ctrl+F5 in IE. See here and here more info.

like image 33
Adrian Fâciu Avatar answered Sep 28 '22 03:09

Adrian Fâciu