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

Forums / Developing with Sitefinity / Email notification of file download

Email notification of file download

3 posts, 0 answered
  1. Chris Williams
    Chris Williams avatar
    14 posts
    Registered:
    25 Oct 2004
    05 Feb 2009
    Link to this post
    I have a need to create a list of files available for download, and then send an customized email with the downloader's name to an email address upon download.

    I've looked at the download list, and the UI will be sufficient for my display needs.  However, I've looked at extending the Telerik.Libraries.DownloadList class but don't see an override method that might be called when a user downloads a specific file.

    Do you have a suggestion for auto-generating email notifications in response to a file download?

    thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    05 Feb 2009
    Link to this post
    Hi Chris Williams,

    We have not implemented required functionality yet. You can try overriding ContentHttpHandler, ProcessRequest method and send a message when an item is clicked/downloaded.

    Example:

    using System;  
    using System.Web;  
    using System.Web.Mail;  
    using Telerik.Cms.Engine;  
      
    /// <summary>  
    /// Summary description for NotifyUsers  
    /// </summary>  
    //Override ContentHttpHandler  
      
    public class CustomContentHttpHandler : ContentHttpHandler  
    {  
        public override void ProcessRequest(HttpContext context)  
        {  
            // add logic here  
            // check current request for a given library called Downloads  
            //all item from Downloads should be used for only for downloading.  
            string path = String.Concat(context.Request.ApplicationPath, "/Libraries/Downloads/");  
            if (context.Request.RawUrl.StartsWith(path, StringComparison.OrdinalIgnoreCase))  
            {  
                // add logic here to get the item name. 
                // send message  
                MailMessage message = new MailMessage();  
                message.From = "";  
                message.To = "";  
                message.Subject = "";  
                message.Body = "";  
      
                SmtpMail.Send(message);  
            }  
            base.ProcessRequest(context);  
        }  
    }  
      

    All the best,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Chris Williams
    Chris Williams avatar
    14 posts
    Registered:
    25 Oct 2004
    05 Feb 2009
    Link to this post
    Ivan,

    Wow, that's a pretty low-level class to override.  I can see it's referenced all through the web.config.

    Thanks for the pointer.  I may just throw the functionality into a user control, but thanks for the options.

    Chris
Register for webinar
3 posts, 0 answered