More in this section

Forums / Developing with Sitefinity / Image&Documents HttpHandlers

Image&Documents HttpHandlers

2 posts, 0 answered
  1. Paul
    Paul avatar
    176 posts
    18 Nov 2008
    19 Oct 2010
    Link to this post


    In my current project I have task which repeats some functionality in Sitefinity CMS. I need to create some HttpHandler which will return Excel and Word documents by clicking the link. How this mechanism realised in Sitefinity (if this is not a secret)? Maybe Sitefinity developers can suggest me some information and links. It will be great to see in future some webinar about this feature as you made before.

    Thank you.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    19 Oct 2010
    Link to this post
    Hello Paul,

    You can use HttpContext.Current.Response.AddHeader and HttpContext.Current.Response.ContentType methods inside your custom HttpHandler.

    To open the file as an attachment you can use

    response.AddHeader("content-disposition", "attachment; filename=" + contentSettings.FileName);

    To open the file inline you can use

     response.AddHeader("content-disposition", "inline; filename=" + contentSettings.FileName);

    Kind regards,
    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
2 posts, 0 answered