0

I developed a .NET web application in Framework 4 allowing to download shared files. These files can be large, up to 5 GB.

So far everything is going well, here is an extract of the code used.

var filePath = (string)e.CommandArgument;
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "filename=" + System.IO.Path.GetFileName(filePath));
Response.TransmitFile(filePath);
Response.End();

The problem with large files is that the download can be interrupted for X reasons (timeout, network cut ...). I would therefore like to be able to resume the download where it left off without starting from 0 and take the risk that it will be interrupted again.

After searching the Net, I couldn't find any viable solution. Do you have a solution to suggest? I admit that I prefer to develop the solution if it is possible.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • Have a look at [this](https://stackoverflow.com/questions/15995705/adding-pause-and-continue-ability-in-my-downloader). It's very similar to your problem. In your case the download would be "paused" by e.g. a `WebException` you'd have to handle. – Michael Schnerring Sep 17 '20 at 09:02
  • You're looking for a "range request", where the client can continue a download starting from the number of bytes they've already downloaded. – CodeCaster Sep 17 '20 at 09:08

0 Answers0