开发者

Accurate way of finding out number of times a file has been download

开发者 https://www.devze.com 2022-12-17 11:57 出处:网络
I开发者_如何学运维 have a download page with a linkbutton that users use to download files. The event handler of the linkbutton sets up the Response type for the user to see the download dialog and ch

I开发者_如何学运维 have a download page with a linkbutton that users use to download files. The event handler of the linkbutton sets up the Response type for the user to see the download dialog and chose to save it. I need to find out accurately how many times the file has been downloaded. If I increment a counter in the link button's event handler, I'd assume it wouldn't be accurate as the user may chose to click on Cancel in the download dialog.

Where exactly do I need to hook this counter incrementing logic?


You may write a HttpHandler which sends the file.

After the sending has finished then you can increment the number of downloads


Route your file through a 2nd .aspx file that simply reads the real file from disk and echoes it to the page, then when it's done, increment the download counter in your database.

0

精彩评论

暂无评论...
验证码 换一张
取 消