Validate the requested range and return an error if it's not correct. End bytes can not be larger than $end.ĪnotherEnd = (anotherEnd > end) ? end : anotherEnd * Check the range and make sure it's treated according to the specs. String arr_split = (new char ) ĪnotherStart = Convert.ToInt64(arr_split) ĪnotherEnd = (arr_split.Length > 1 & Int64.TryParse(arr_split.ToString(), out temp)) ? Convert.ToInt64(arr_split) : size If (!String.IsNullOrEmpty(request.Headers)) Response.AddHeader("Accept-Ranges", "0-" + size) Size = new System.IO.FileInfo(finalPath).Length
Using (StreamReader reader = new StreamReader(finalPath)) String finalPath = size, start, end, length, fp = 0 I have written a code for enabling multiple connection download(Range-Requests) through Internet Download Manager and it works fine in my local system(it is able to create multiple connections and download a file.) but it's not able to create more than one connection in my server (Windows 2012 R2).Īlso, when I keep a file on download and try to open another webpage of my application, it shows loading and does not open(until I cancel the download or let the download to complete.)īelow is my downloader code: public ActionResult getFile()