1
我有一个处理程序,它应该为它提供下载。这是重要的代码:ASP.net c#部分获取请求
// Get size of file
FileInfo f = new FileInfo(Settings.ReleaseFileLocation + ActualFileName);
long FileSize = f.Length;
// Init (returns ID of tblDownloadLog record created with blank end date)
int DownloadRecordID = Constructor.VersionReleaseDownload.newReleaseDownload(ActualFileName);
context.Response.Clear();
context.Response.Buffer = false;
context.Response.ContentType = "application/octet-stream";
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + OriginalFileName);
context.Response.AddHeader("Content-Length", FileSize.ToString());
context.Response.TransmitFile(Settings.ReleaseFileLocation + ActualFileName);
context.Response.Close();
// Complete download log, fills out the end date
Constructor.VersionReleaseDownload.completeReleaseDownload(DownloadRecordID);
的context.Response.Close();
确保completeReleaseDownload()
只有下载完成时,这是非常有用的(再Only count a download once it's served)
问题是,我们得到了很多而来日志运行从大约相同时间间隔的相同IP地址。深入挖掘后,看起来他们是使用下载Resumer软件的用户。
当我尝试使用下载resumer时,它似乎失败。我的问题是:
- 如何检测这部分请求
- 我怎么能起到部分请求
- 我怎样才能使它与上面的代码工作,所以一)呼吁
https://www.scirra.com/downloads/releases/construct2-r68-setup_4.exe
在它第一部分得到和b)在最后部分得到电话completeReleaseDownload
?
我认为这会回答你的问题 http://stackoverflow.com/questions/5429947/supporting-resumable-http-downloads-through-an-ashx-handler –