Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > WinForms/Console Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the WinForms/Console Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 1st, 2010, 09:18 PM
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default clear cache for WebBrowser

Assume I have a WebBrowser control called webBrowser1, and I would like to use it to display an image, which changes from time to time. I thought that I could show the most up-to-date image by calling the following line:
webBrowser1.DocumentText = "<img src='foo' width='100%' height='100%'>";
But that didn't work, and looked like WebBrowser kept a cached image.

I tried Refresh() and Refresh(WebBrowserRefreshOption.Complete), and none of those worked either.

I can make it work by set url to foo and then call Refresh(). But that won't work for every situation, for example when I have multiple images on the page.

Last edited by PeterPeiGuo; March 2nd, 2010 at 12:44 PM.
Reply With Quote
  #2 (permalink)  
Old March 2nd, 2010, 01:28 AM
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

Figured out. One solution is to do the following:

import this:
[DllImport("wininet.dll")]
private static extern long DeleteUrlCacheEntry(string lpszUrlName);

and call it
DeleteURLCacheEntry(image_url);
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webbrowser control mussie C# 2005 1 March 2nd, 2010 12:10 PM
Webbrowser content vincentvdm BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 January 12th, 2008 09:52 AM
Some doubts about WebBrowser Control Xc0d C# 2005 4 November 5th, 2007 10:31 AM
webbrowser question pascali70 C# 2005 0 December 29th, 2006 09:11 AM
WebBrowser control atingoldy Beginning VB 6 1 June 16th, 2003 06:00 AM



All times are GMT -4. The time now is 12:47 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.