1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Images & Documents - recording downloads

Images & Documents - recording downloads

4 posts, 1 answered
  1. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    11 Mar 2010
    Link to this post
    Hi Ivan,

    I wonder if you might be able to advise me on the best way to record when a document gets downloaded from one of the libraries.

    In parts of our site, we link to documents stored within the Images & Documents module, under a specific library, for example:

    http://www.domain.com/Libraries/Reports/Test_Report_Title.sflb.ashx

    I want to write a system where I can record every time a document is accessed, so I can increase a counter and also stored who it was (Users have to be authenticated before downloading these files, so I can get their Membership information too).

    Should I be writing a custom HttpModule to do this, and will it work ok in conjunction with:

    <add verb="*" path="*.sflb.ashx" type="Telerik.Cms.Engine.ContentHttpHandler, Telerik.Cms.Engine" />

    ?


    Regards,
    Alvaro
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    11 Mar 2010
    Link to this post
    Hello Alvaro,

    Create a custom class that inherits from ContentHttpHandler. Override ProcessRequest(HttpContext context. Get Request.ApplicationPath and RawUrl. You can get the current user from the context or by using UserManager class. You can save the data to a custom table in the database using SqlCommand  or Linq - SQL.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  3. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    11 Mar 2010
    Link to this post
    Great, many thanks Ivan.

    I guess I then replace the ContentHttpHandler from the web.config with my own inherited class?


    Regards,
    Alvaro
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    11 Mar 2010
    Link to this post
    Hi Alvaro,

    You need to replace the default ContentHttpHandler with the custom one. Otherwise your handler will not be called.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 1 answered