How to Store web pages to local disk using httpwebrequest

G

Guest

Hi all,

I have a problem downloading web pages to my local system. I am using the
HttpebRequest class to query a web site and get the response from the same.
UndNow, when i asy a web page, all the images and support files such as JS
file, CSS files are also in picture.

I want to store the response stream to the local drive, say something like
"C:\Temp", and i want all the images and CSS files to be stored to this local
path.

Please mention any methods (sample codes will be of great help), to store
the web pages along with the images, to my local hard disk.

Thanks.
Indiresh.
 
B

Bruce Barker

you need to parse the html for references, then fetch them. this can get
complex if javascript is modifing the html. in this case, you need to also
interpret (run) the javascript. also be sure to check if one of the
refernces is html, you need to do the same on it.

-- bruce
 
R

Russell

Not to mention the need to update the referenced URLs in the HTML now
that the relevant items are localized. Since you can't get around
changing the references, you could just convert any relative URLs to
absolute ones and not actually download the items.
 
G

Guest

Hi,
Thanks for the response. Actually, I can go for HTML parsing, but there are
many conditions which i need to check for. And while parsing, it can take in
some considerable time, whereas i am keeping in view the performace issue as
well.

Hence, i want to implement/Automate the Internet Explorer's SAVE AS
functionality, where i can point to my defined folder and store the images
and all other files at one shot.

Thanks,
Indiresh.
 
Joined
Jun 19, 2007
Messages
1
Reaction score
0
I made a little script that I call using the "Links" as:
-----------------
oShell= new ActiveXObject("WScript.Shell");
oShell.SendKeys( "^c" ); // copy
oShell.SendKeys( "%FA" ); // save As Type
oShell.SendKeys( "%n" ); // name
oShell.SendKeys( "%n" ); // name
oShell.SendKeys( "^v" ); // copy
//oShell.SendKeys( "%s" ); // name
//oShell.sleep(1000);
oShell.SendKeys( "%t{DOWN 2}~" ); // save As Type
oShell.SendKeys( "%t{UP 1}" ); // save As Type
oShell.SendKeys( "%s" ); // enter

------------------------

But this is not a great solution...

Do you know a better way?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top