开发者

Check how many times file downloaded?

I have a zip file on website running on a Windows 2008 / IIS7 server. Is there a way to check h开发者_运维百科ow many times that file was downloaded?


You can do it in so many ways

(in the order of increasing complexity and stupidity) ;)

  1. Provide direct link to a file and monitor your web logs. You can use a LogParser tool from microsoft to run SQL like queries against the logs to extract data you need.

  2. Don't provide a direct link to a file. Have a button instead. When a button is clicked you increment the counter and serve the file.

  3. You can use URL shortening services (e.g. bit.ly) - they can provide you with the click stats etc

    E.g. if you append a '+' sign to the end of the bit.ly URL you will get the stats. Or you can register on their site.

    As a variation - use your own service. I.e. have a lookup table:

    shortcode1 - Path1\File1.ext
    shortcode2 - Path2\File2.ext
    ...
    shortcodeN - PathN\FileN.ext

    a link to download your zip file will then look like:

    http://www.yoursite.com/getFile.aspx?code=shortcode1

    getFile.aspx gets executed, performs a lookup, updates stats, serves Path1\File1.ext back.

  4. You can use monitoring tools to keep track of which files were uploaded/downloaded E.g. http://www.iis.net/community/default.aspx?tabid=34&g=6&i=1494

  5. Create/Use an ISAPI extension to monitor file downloads

  6. Map .zip extension through ASP.Net in IIS and a corresponding code to properly react and update stats.


Yes this information is located in the log files. You can parse it using awstats or webalizer.

Altenatively you can write your own file download counter or create a special download page for your file.

I prefer the last one and most download sites use that simple method.

However to get the most accurate numbers, parse your log files.


Or you directly track it with Google Analytics

<a href="http://www.example.com/files/map.pdf" onClick="javascript: _gaq.push(['_trackPageview', '/downloads/map']);"> 

more info on this here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜