Uploading a file by clicking the image button
On my .aspx page I have an image button which when I click on it I want to download the file.
When the button is clicked, it first writes everything to do db.
How can I push a file to download? I don't want to transfer the file via asp.net server side, just let the user upload the file.
Is it possible?
a source to share
Ask the page to redirect the url for the PDF. There are several ways to do this.
-
Change the response of the ASPX page to HTTP
301302 with the headerLocation:
set to the url of the PDF file. -
Returns HTML, but with a script (javascript) running that sets window.location to the url of the PDF file.
-
Return HTML but with META to redirect to PDF
If you want more control over how PDF is processed in the browser, you can write ASHX that transfers PDFs and sets headers such as Content-Disposition .
a source to share