views:

89

answers:

3

Hi,

I want to develop an asp.net page through which I can specify the URL of any page which contains links of many files & directories. I want to download them all. Similar to DownThemAll plugin of FireFox.

i.e.

"MyPage.htm" file contains many links to files/directories located on the same server.

now I want to write a function which can download all these file if I provide

"www.mycustomdomain.com\Mypage.htm" as input.

I hope question is clear.

+1  A: 

Hope I understand your question. You have a HTM file with a list of links and these links are links to specific files on a remote server and you want to download all the files.

There is no fail proof way to do this.

Check this question. How do you parse an HTML in vb.net Even though this is for VB.net it is related to what you asked for. You can get an array of links and then start downloading the files.

You can use the Computer.Network.DownloadFile method to download the remot file as save it on a location of yours.

Thi is not a fail prrof method because if a download requires authentication then it will download the HTML page [mostly loin page]

Shoban
+1  A: 

Fetch the web page as HTML. Google (c# fetch file from web). The first link will give you the idea.

Then find the links with regular expressions. Some example regex pattern for links in www.x.com should be as (http://www.x.com/.*?) (But better if you also include the A tag in your regex pattern)

And download the files as shown in: http://www.csharp-examples.net/download-files/

Aykut