Code Code:
Dim myWebClient As New WebClient() ' Me.Text = "Downloading Image" Dim img As HtmlElement For Each img In WebBrowser1.Document.Images If img.OuterHtml.Contains("vacation") Then Dim fileName As String = "vacation.jpg" Dim myStringWebResource As String = Nothing myStringWebResource = img.GetAttribute("src") myWebClient.DownloadFile(myStringWebResource, fileName) myWebClient.CachePolicy = New RequestCachePolicy(RequestCacheLevel.NoCacheNoStore) End If Next
On each refresh in webbrowser1 the "vacation" image changes. I need it to download the new image every time.
It only downloads an image once. If I have it download again it will only download the last image which is why I thought it was caching it - not doesn't seem to be the issue because I made webclient nocache/nostore.
I launch the program - and it downloads the new image.
It will not download an image twice... It seems like it is caching the first but heh...
What's going on?
Update:
It looks like it can't overwrite vacation.jpg with the new image because its in use... I tried to do " myWebClient.Dispose()" but that doesn't fix the problem.


Reply With Quote
