ASP.Net Count Download Clicks

Posted by Marco on Stack Overflow See other posts from Stack Overflow or by Marco
Published on 2010-03-22T23:51:28Z Indexed on 2010/03/23 0:01 UTC
Read the original article Hit count: 472

Filed under:
|
|
|

Hello,

I thought that this was easier…

I have a asp:hyperlink control, with target=”_blank”, pointing to the file I want the user to download. My plan is to track the number of times, the users click on this link.

I thought in placing it in ajax update panel, to catch the postback and avoid full page refresh.

However, hyperlink doesn’t have a onClick method.

On the other hand I could use a linkbutton, which has a onClick built in. But It’s harder to make the file open in a new window… and I would also have to do something like:

Response.AppendHeader("Content-Disposition","attachment; filename=myImage.jpg");

But I heard that the above approach has some problems with PPT, PPTX, PPS, PPSX…

What is you'r opinion on this? How and why, would you do it?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about onclick