In my application, user will open multiple tabs by clicking on menus. Each tab is dynamically created and containing webbrowser control to load URL.
Each URL point to same server and some of URL does not have access so , gives Resource not have access
error received.
Now, problem is, example- If user directly click on Menu3
and related tab loaded with webbrowser URL and follow to next, URL contain other popup link then it works and able to popup the URL.
Now, user click on Menu5
where not have access so, get this error Resource not have access
(denied from server). Its fine.
NOw, again URL reach to
Menu3and try to open sub link to popup dialog then it gives
403 forbidden error- decline access`. It works initially but, later it just giving this error.
As it looks, I need to clear the WebBrowser Control
cache or forcely start with new session.
Can any one please guide me how to force WebBrowser to start new session or remove earlier caches ?
The cache of the WebBrowser control is the same of Internet Explorer. You have various options:
1) Completely clear that cache (will also clear Internet Explorer!):
https://stackoverflow.com/a/24401521/2633161
2) Use some tags in the server response:
3) Use a random query string to force the refresh:
4) Force refresh of the page (this will load the page 2 times!):
There is a better alternative. It's using the WinINet.DLL and calling SetInternetOptions
This will end the browser's session cache. After you call this method the webbrowser control will forget whatever sessions had in memory