简体   繁体   中英

Confirm that file has been downloaded

Is there a way to confirm that a user has downloaded a file? (As opposed to having refused the download, or cancelling it in the middle?) Preferably in c# codebehind.

When using: Response.Write(...); .

You can use Response.IsClientConnected to check if still client is connected.

From 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.

After write to response using Response.Write , execute this to check if client is connected, if that is true means file is written to response/ downloaded.

http://msdn.microsoft.com/en-us/library/ms525453(v=vs.90).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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