简体   繁体   English

如何获取文件从服务器端到客户端-Asp.Net的下载时间?

[英]How to get the downloading time of a file from server side to Client side - Asp.Net?

I make the request from client side aspx page and able to download a file in server side. 我从客户端aspx页面发出请求,并能够在服务器端下载文件。 It takes around 6 to 15 sec randomly. 大约需要6到15秒。 Once the file download is completed, i want to send time log to client side from asp server page. 一旦文件下载完成,我想将时间日志从ASP服务器页面发送到客户端。 how can i send the time or message back to client side indicating the download has completed in particular timing ? 我如何将时间或消息发送回客户端以指示在特定时间已完成下载?

I'cant tell you exact solution but for example like that (server involved solution): 我不能告诉您确切的解决方案,但是例如(服务器涉及的解决方案):

  1. Implement server action that returns download time by download id. 实施服务器操作,以下载ID返回下载时间。 Let's say domain.ext/getdownloadtime?id=39994884 假设domain.ext / getdownloadtime?id = 39994884
  2. When download is requested from client, store download identity inside user session on the server (this should be implemented as List if user can have multiple downloads at time). 当从客户端请求下载时,将下载标识存储在服务器上的用户会话内(如果用户一次可以进行多次下载,则应将其存储为列表)。
  3. When download is finished on clients side request server action (getdownloadtime) with id according to recently finished download. 在客户端完成下载后,请根据最近完成的下载请求具有ID的服务器操作(getdownloadtime)。 You can do it with javascript background request. 您可以使用javascript后台请求执行此操作。 When server returns download time just display it as you want. 服务器返回下载时间时,只需显示它即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM