We have this code which serves a download:
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);
It works fine, except that the log download code runs as soon as the download starts seemingly, not when the download has fully completed as we expect.
Can someone explain why this is, and how to change it so it only logs when it's completed? We don't want to count partial downloads.