BlogEngine.NET extension: Detailed Download Counter

Lately, I have been posting some source code and I wanted to know how many times the source code was downloaded. I searched the internet and quickly found an Extensions page on the official BlogEngine.NET website. I noticed there were several different download counters available. I will list them here shortly with the cons and the pros.

1) Counter Extension by RTur

  • Stores every download (so advanced statistics are available)
  • The overview is not an overview (counts per file are not available)

2) Simply Download Counter by Al Nyveldt

  • Download count is displayed in the blog posts itself
  • No settings available to determine who can view the download count
  • Downloads are not stored separate (only the number of downloads per file)

3) File Download Tracker by Chris Blakenship

  • It shows a good overview which file is downloaded how many times
  • Downloads are not stored seapare (only the last download date and the number of downloads per file)

None of these counters could provide the functionality I really wanted. I simply wanted a counter that allowed me to decide at run-time whether I wanted anonymous users to be able to view the number of downloads. Also, I wanted a more structured way of storing and viewing the downloads per file. Since the original extensions didn't too look difficult, I decided to dive into the world of BlogEngine.NET extensions.

What I have developed is a solution that fits my needs (and probably others as well). The Detailed Download Counter saves the information per file, but also stores the timestamp, user agent and user host. This gives anyone the ability to create more advanced statistics. For the moment, I have only implemented a grid which simply shows an overview of the files downloaded and the details of a file. To get a grip of the current implementation, please view the image below:

To install the Detailed Download Counter extension, simply extract the zip file to the root or your BlogEngine.NET application. 

DetailedDownloadCounter.zip (6.69 kb) [Downloads: 196]

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Comments

February 18. 2009 14:47

Jim

Thanks for sharing this, it looks nice and what I am looking for.  I have added it to my blog and see that it shows in Extension Manager.  But after download a file, I do not see anything show in the Extension Manager when clicking on the Settings link.  

Also, other extensions Picasa from RTUR no longer work...?

Jim

February 18. 2009 14:50

Geert van Horrik

I am not sure about the Picasa extension, but it is strange that nothing shows up.

Do you really mean nothing, or just no downloads?

Geert van Horrik

February 18. 2009 14:50

Jim

Maybe I should be asking how to add a link to a file to download?  I just added a link to the zip file in a folder on my server.  See my downloads page.

Jim

February 18. 2009 14:53

Geert van Horrik

I use the editor to add files (since they are uploaded automatically in that case as well). However, the script looks at the following handler:

../../file.axd?file=2009%2f1%2fDetailedDownloadCounter.zip

So, instead of directly linking to Studio.zip, you should use ../../file.axd?file=[YOUR FILE THAT THE HANDLER CAN FIND]

Geert van Horrik

February 18. 2009 16:35

Jim

Ok, I was manually FTPing the file to a directory.  I now used the post edit feature and uploaded the file and now using the proper link with /file.axd?file=.  I downloaded it twice (both logged in and not logged in) and I still do now see any downloads showing up.

Jim

February 18. 2009 16:41

Geert van Horrik

Some things to check:

1) Is the add-in enabled? (you can check this by enabling the count visibility for non-authenticated users, download 0 should show up in that case).

2) Is a file being created (DetailedDownload.xml) in App_Data?

Geert van Horrik

February 18. 2009 17:02

Jim

Yes, the add-in is enabled.  I changed a setting for "Show download count for authenticated users only" a few times.  I verified the DetailedDownload.xml file is in App_Data\DataStore\Extensions.

Any thing else?  Picasa and LightBox extensions still not working either... I think it is all tied together some how.  I modified the web.config and uploaded it again to reset it all, but no luck.

Jim

February 18. 2009 17:11

Jim

I've tried Disableing them all and then re-enabling them all, but no luck.  By the way, everytime I add an Add-in or Disable/Enable, I get a .net error, refresh and then it works.

Error:
The process cannot access the file 'c:\hosting\webhost4life\member\jrblack10\Jim\App_Data\datastore\extensions\AkismetExtension.xml' because it is being used by another process.

Jim

February 18. 2009 17:20

Geert van Horrik

Strange, maybe you found a bug in BlogEngine.NET. I suggest you post this bug there since it seems all your extensions have stopped working.

Geert van Horrik

February 20. 2009 20:58

Jim

I removed a few extensions and re-added them, now Picasa, LightBox work again.  Added your extension again and nothing broke, but your extension does not seem to record any file downloads.  The files are .zip fils and they are uploaded with the blog interface using the proper "/file.axd?file=[YOUR FILE]" in the link.

Interestingly... I have tried 2 other download counters for BlogEngine and I can't get any of them to work.

Any suggestions?  Feel free to see the links in my "Downloads" page.

Jim

February 20. 2009 21:04

Jim

The DetailedDownloadCounter.xml file does exist in the data folder and the folder does have all the wright permissions required.

Jim

February 23. 2009 08:48

Geert van Horrik

I have absolutely no idea why the download counters are not working. I think it's best if you post this in the forum for BlogEngine.NET since this is not a problem of 1 single extension.

Geert van Horrik

February 23. 2009 15:19

Jim

I opened a discussion in the BlogEngine.Net Forum.

www.codeplex.com/.../View.aspx?ThreadId=48237

Jim

February 24. 2009 16:49

trackback

Extension Manager bug in BlogEngine.NET 1.4.5

Extension Manager bug in BlogEngine.NET 1.4.5

Black's Web

April 7. 2009 15:57

CudjoeBill

Great extension. Thanks for sharing.

CudjoeBill

June 24. 2009 07:03

my tech addict


I'm quite new to BlogEngine.NET. but what you write in this post is really good and very informative.
I think it will help me in the future. Thanks for the great work

my tech addict

June 27. 2009 17:52

Tukang Nggame

How do I use on wordpress because I'm currently using Wordpress for a few of my sites.

Tukang Nggame

June 28. 2009 07:45

Geert

This counter is for BlogEngine.NET only.

Geert

July 20. 2009 23:18

trackback

Detailed Download Counter

Detailed Download Counter

Random-access memory

Comments are closed