Nick
Nick

Reputation: 7525

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

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?

Upvotes: 1

Views: 236

Answers (2)

Aykut Akıncı
Aykut Akıncı

Reputation: 1302

You may write a HttpHandler which sends the file.

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

Upvotes: 4

Blindy
Blindy

Reputation: 67447

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.

Upvotes: 0

Related Questions