Discussion:
Is WinInet right for downloading a web page?
(too old to reply)
KG
2004-10-08 20:27:29 UTC
Permalink
Hi, I'm trying to see how I would go about "downloading" a web page,
specifically going to a URL, downloading the HTML to a file, as well as any
referenced images, stylesheets, etc. This is along the lines of "Save As
Web Page" within IE.

Any advice is appreciated (I won't get into the interop from C# stuff yet.)

Thanks,

Kris
Brian Cryer
2004-10-11 12:05:30 UTC
Permalink
Post by KG
Hi, I'm trying to see how I would go about "downloading" a web page,
specifically going to a URL, downloading the HTML to a file, as well as any
referenced images, stylesheets, etc. This is along the lines of "Save As
Web Page" within IE.
Any advice is appreciated (I won't get into the interop from C# stuff yet.)
Thanks,
Kris
In my opinion, if you want to download a page, then WinInet isn't the way to
go. Instead use an embedded WebBrowser control. That provides everything you
get with Internet Explorer, so you can tell it to load a page, it raises an
event when the page is loaded and then you can save to a file or whatever.

If you go the route of using WinInet then you will have to parse the html
file to identify what style sheets, images, etc that it uses and then worry
about downloading them yourself.

Hope this helps,

Brian.

www.cryer.co.uk/brian
KG
2004-10-12 01:03:34 UTC
Permalink
Thanks Brian, I finally realized doing this via MSHTML is quite easy, since
you get the document instance after loading, so traversing the images
collection and saving it a snap.

Thanks,

Kris

Loading...