How to Force file download box when clicking on a link for a .pdf file

  • Thread starter Thread starter karups
  • Start date Start date
K

karups

hi,

Can some one help me out?


How to Force file download box when clicking on a link for a .pdf file.

Normally it opens the pdf in IE itself, instead it should ask for (open

, save and cancel)


Similarly , also clarify that, is there any other method other than
Response.Redirect(filename) to download a file. If so what it is?
Please do help me


thanks in advance
appu
 
You have to send out a ContentType header:

Response.AppendHeader ( "Content-Type", "application/pdf" )

And then add another header called Content-Disposition

Response.AppendHeader ( "Content-Disposition", "attachment;
filename="downloaded.pdf" )

If you are going to use this then you will have to output the PDF from
your aspx page (I am sorry but I have never done this in ASP.NET so I
don't know how you would go about doing this...).
 
Back
Top