c# - 如何判断文件是否已下载?

标签 c# asp.net download transmitfile

我有以下代码,允许用户下载文件。我需要知道(如果可能的话)他们是否成功下载了文件。是否有任何类型的回调可以让我知道他们是否成功下载了它?

string filename = Path.GetFileName(url);
context.Response.Buffer = true;
context.Response.Charset = "";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.ContentType = "application/x-rar-compressed";
context.Response.AddHeader("content-disposition", "attachment;filename=" + filename);
context.Response.TransmitFile(context.Server.MapPath(url));
context.Response.Flush();

最佳答案

为什么不再添加一行让您知道它已经完成了?在 context.Response.Flush() 之后,应该完成。

关于c# - 如何判断文件是否已下载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1526947/

相关文章:

c# - Byte Vigenere Cipher,解密错误

asp.net - 通过 PayPal 使用自定义按钮

asp.net - 通过http将数据从服务器推送到浏览器

android - 怎么把网站的文件存到sd卡

c# - ID不匹配时返回错误请求

c# - 从字符串中删除页码

asp.net - 如何在 ASP.Net MVC 中执行 301 永久重定向路由

javascript - 如何在 Appcelerator 中安全下载文件?

javascript - 如何在现代浏览器中单击 html <a> 标记或 javascript 时触发文件下载

c# - ScrollableControl 在整个控件周围绘制边框