有没有办法确认用户已经下载了文件? (与拒绝下载或中途取消下载相反?)最好在 c# 代码隐藏中。
使用时:Response.Write(...);
.
最佳答案
您可以使用 Response.IsClientConnected
来检查客户端是否仍然连接。
来自MSDN
This property enables you greater control over circumstances where the client may have reset the connection to the server. For example, if a long period of time has elapsed between when a client request was made and when the server responded, it may be beneficial to make sure the client is still connected before continuing to process the script.
在使用 Response.Write
写入响应后,执行此命令以检查客户端是否已连接,如果为真则表示文件已写入响应/已下载。
http://msdn.microsoft.com/en-us/library/ms525453(v=vs.90).aspx
关于c# - 确认文件已下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27018214/