0

VS 2008 SP1

I am using the web client to download a file. Which works ok.

However, now I have to download many and the number of files to download will change everyday.

I am not sure how I can get the web client to know which files have been downloaded or not? I was thinking of using a for loop to download each file. But I will never know how many there are to download?

The web client could download the same file twice?

Many thanks for any suggestions,

Private Sub btnStartDownload_Click(ByVal sender As Object, ByVal e As EventArgs)
 Dim client As New WebClient()
 AddHandler client.DownloadProgressChanged, AddressOf client_DownloadProgressChanged
 AddHandler client.DownloadFileCompleted, AddressOf client_DownloadFileCompleted

 ' Starts the download
 client.DownloadFileAsync(New Uri("UrlFilePath"), "DownloadPath")

 btnStartDownload.Text = "Download In Process"
 btnStartDownload.Enabled = False
End Sub
John Koerner
  • 35,668
  • 7
  • 74
  • 128
ant2009
  • 30,351
  • 141
  • 365
  • 559
  • Possible duplicate of [How to download multiple files with one HTTP request?](http://stackoverflow.com/questions/1041542/how-to-download-multiple-files-with-one-http-request) – Helen Jan 23 '17 at 09:38

2 Answers2

1

We have previously built a system that required the the user download many files. The way we solved it was to zip the files on the server side then download it as a single file.

Shiraz Bhaiji
  • 60,773
  • 31
  • 133
  • 239
  • I can't really do that. The users want all the individual files downloaded and don't want to have to unzip them. – ant2009 Jul 30 '09 at 19:11
  • Are these internal users? Will they always be on an internal network? Do they have Office enterprise licences? – Shiraz Bhaiji Jul 30 '09 at 19:14
  • These are user that will install our software and download the updates through the Internet. – ant2009 Jul 31 '09 at 00:29
1

You could try using a multi-part content type and BinaryWrite but my understanding is that browser support for that content type is spotty at best.

How to download multiple files with one HTTP request?

Community
  • 1
  • 1
MyItchyChin
  • 12,915
  • 1
  • 21
  • 43