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 –