Developer forum

Forum » CMS - Standard features » Force download files

Force download files

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,
I remember that we used to use DWSDownload.aspx with a File parameter for forcing the download of files.
Is this still usable in DW10 or there is another alternative?

Thank you,
Adrian 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,

DWSDownload.aspx no longer exists in DW10.

What can be used instead:

For image files — the Image Handler supports ForceDownload=true as a query parameter, optionally combined with FileName=customname.ext:

/path/to/image.jpg?ForceDownload=true&FileName=my-download.jpg

For non-image files (PDFs, docs, etc.) — there is no built-in URL-based equivalent. Your options are:

  1. HTML download attribute (client-side, same-origin only):

    <a href="/Files/Files/example.pdf" download="example.pdf">Download PDF</a>
    
  2. Custom middleware/controller endpoint that reads the file and writes the attachment headers manually.

The download attribute covers the most common template use case.

BR, Dmitrij

 

You must be logged in to post in the forum