This project is read-only.

FileHandler.Served Event -- File download counter

Topics: Business Logic Layer
Jun 24, 2010 at 5:43 AM

I have been playing with a couple extensions that others have written that capture the number of times files have been downloaded via the FileHandler.  The majority of the files that I am making available are MP3 files.  I have windows media player start up as soon as I click the link, the file opens fine, however I am noticing that the FileHandler.Served event is occurring 3 times for the one click of the link.  This then inflates the file counter by 3 instead of by 1.  I suspect this has something to do with the way Media Player is requesting the file when opening it. 

If I then right click the link and select 'save target as' and save the file, I see that the FileHandler.Served event only occurs once, which then only adds to the count by 1 which is what is desired.

Is there any way to determine either which of the three instances of the event to count? or to only make the event occur only once? Or any other suggestions?

The download counters that I am using are:
Simple BlogEngine.NET Download Counter Extension 
Track file downloads – BlogEngine Extension and Control

Any help would be greatly appreciated.