gjshah7254
5/12/2014 - 3:35 AM

Force browsers to download PDF

Force browsers to download PDF

Below line will get a download link or new tab for the media  file:
<%# HTMLHelper.HTMLEncode(MediaLibraryFunctions.GetMediaFileUrl(Eval("FileLibraryID") ,Eval("FilePath"), Eval("FileGUID"), Eval("FileName"), GetDataControlValue<bool>("UseSecureLinks"), false)) %>

If you change the false to True it will download the file instead of opening in a new tab.
When you set it to True it will add disposition=attachment behind the URL which will make it to download directly.