【发布时间】:2011-11-23 22:49:33
【问题描述】:
我们有此代码可供下载:
public class downloadRelease : IHttpHandler {
public void ProcessRequest (HttpContext context) {
-- snip --
context.Response.Clear();
context.Response.ContentType = "application/octet-stream";
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + OriginalFileName);
context.Response.WriteFile(Settings.ReleaseFileLocation + ActualFileName);
// Log download
Constructor.VersionReleaseDownload.NewReleaseDownload(ActualFileName);
它工作正常,只是日志下载代码似乎在下载开始时立即运行,而不是在下载完全完成时运行。
有人可以解释这是为什么,以及如何更改它以使其仅在完成时记录?我们不想计算部分下载量。
【问题讨论】: