English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Im trying to capture a click event so I can count the number of downloads. But not all content is hosted on my site because users post their own link. Id have a hard enough time capturing the number of downloads of a file, and especially people are right-clicking save as. Is there any way to capture this event in IIS wor .NET?

2007-01-24 14:45:57 · 1 answers · asked by TheAnswerGuy 2 in Computers & Internet Programming & Design

I cant re-direct because it is unreliable. Some filenames may contain spaces which (in this case) would like to keep. Some browsers get Bad Request Errors

2007-01-24 15:24:40 · update #1

Also some browsers will try to play or otherwise pre-load the file when the user is trying to download it when using re-directs

2007-01-24 15:26:18 · update #2

1 answers

Why don't you create a redirect to the file you are linking to in ASP...

Create a blank text file and call it download.asp, and inside it put:

<%
Response.Redirect("url of actual file")
some code here to log maybe to a database or something
%>

Then just link to that and not to the file.

Edit:

If you don't put some process between yourself and the requested file, there is no way to track it. When a user clicks a link that takes them to another domain, it is the same as if they opened a new browser and pasted that URL in to the address bar. In other words, your server is not notified of hits going to other servers, for obvious reasons.

You might be able to put some kind of Ajax JavaScript click event on the link, but I am not sure if the script would finish invoking before the browser destroys your page, since Ajax is asynchronous. Worth trying I suppose...

2007-01-24 15:12:10 · answer #1 · answered by Rex M 6 · 0 0

fedest.com, questions and answers