我使用ashx处理程序向用户发送请求的文件,如下面的代码:
// Here . Log the time and IP of the whom request the file
context.Response.ClearContent();
context.Response.Clear();
context.Response.ContentType = "application/vnd.android.package-archive";
context.Response.AddHeader("Content-Disposition", "attachment; filename=AppName.apk");
context.Response.TransmitFile(HttpContext.Current.Server.MapPath("~/AppName.apk"));
context.Response.Flush();
context.Response.End();
之前,发送文件我记录了用户请求。 但是我遇到了一个问题,有时候,一个请求的日志计数不止一次,而且我不知道为什么会发生这种情况,怎么可能避免呢? 另外,记录请求的最佳解决方案是什么,可以指定请求计数?