I found a link here on Stack that explains how to do this, but it explains it only in PHP lingo. I want to have links on my website to a PDF file so that it automatically goes to a “save as” screen instead of opening up in a web page form. This way, the end user will be able to download it easier, because a lot of my clients don’t know how to do a file/save as on a web page.
So I want to have a link such as:
<a href="brochure.pdf" target="_blank">Download Brochure</a>
then it’ll go right to a “save as” box and allow the client to save the PDF brochure to his/her computer without opening up another web page. Any help would be appreciated!
if you replace “brochure.pdf” with an asp.net page that contains the following code in the Page_Load event, you’ll get the desired behavior:
Another approach would to include a link button that has the above code in it. For security purposes, be sure you validate the filename however you assign it so users don’t gain access to arbitrary files.