Saving a website WITH images by using the system.net.webClient  
Author Message
S_A_S





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

How can I save a website including the imagefiles an not only the htmlfile by using the system.net.webClient I tried a few ideas but no one really worked well.

.NET Development15  
 
 
Mariya Atanasova - MSFT





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

Did you try parsing the html received and then for each file ending in .jpg, gif, (needed image names) go to the url and download it too

Mariya


 
 
S_A_S





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

What I tried was loading the websitve via system.net.webClient into a sting an then a looked for each HTML image-tag in the string and with STRING.remove I thougt I could separate the URL of the image but that didn't realy work.

Is there a method to user IE's website downloader without using the WebBrowser control - this could be easier.


 
 
Mike Flasko





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

Via the system.net namespace you will need to download the .html file, parse it (potentially by looking for <IMG SRC="<IMAGE>" > tags) and make seperate download requests for each such resource

 
 
S_A_S





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

That was that what I tried but I didn't got the image URL's separated from der original HTML Code in the string by unsing STRING.remove() / SRING.replace() ....
 
 
Mariya Atanasova - MSFT





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

No, you don't replace the strings in the HTML file. What you need to do is parse that html file, get where exactly the .jpg are stored and then issue separate request for downloading each of those jpg file

Mariya


 
 
S_A_S





PostPosted: .NET Framework Networking and Communication, Saving a website WITH images by using the system.net.webClient Top

And How do I do that All my ideas didn't work.