Solved

Save images from WebBrowser/IHTMLDocument

Posted on 2003-11-14
3
1,199 Views
Last Modified: 2009-07-29
Hi,
I'm writing an application that uses a WebBrowser control to save webpages for offline reading. I am able to get at the html source fine and save that, but getting the images is proving to be tricky. Currently, I get a list of the of images from the Document property, by looping through each IHTMLImgElement in the Document.Images element collection. That gives me the name and the final url for the image, so I use a WebRequest to download the image.

I feel there is a better way to get these images. The WebBrowser control has already downloaded these images to display them and I don't like having to download each image twice, it seems like a big waste of resources. Is there anyway to get each image from the WebBrowser control, by extracting it from the DOM or something?

Anyone who can point me to an MSDN or other article on how to extract this information, or provides a code example will get the points.

Thanks
0
Comment
Question by:fieldofasphodel
  • 2
3 Comments
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9754302
Yes, since you already downloaded the images you can get them from the browser cache.
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 500 total points
ID: 9754395
Here is a link:
http://www.graphcomp.com/info/specs/ms/inetr007.htm

But when you don't explicitly bypass the cache you should get it from the cache anyway.
0
 

Author Comment

by:fieldofasphodel
ID: 9765373
Thanks, this will help out a lot. I'd rather explicitly get my images from the cache, it's very important to my project that I don't get the image from the server twice. Using this rather than assuming my WebRequest is getting cached images gives me that reassurance.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
install app on other machine 13 32
How to LOAD up a .NET Framework website with data? 2 40
Parse the OuterHTML Data in the txtfile using c# 4 48
Error on link 14 37
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now