how to restrict opening pdf file in browser
-
Hi All, I have a html page in my project in which there is a link for a pdf file. When i click**(left)** on that link it opens in brwser without showing the save file dialog box as it is showing when i do right click. Thanks in advance, Vijay Kumar
-
Hi All, I have a html page in my project in which there is a link for a pdf file. When i click**(left)** on that link it opens in brwser without showing the save file dialog box as it is showing when i do right click. Thanks in advance, Vijay Kumar
Use the content-disposition header like this:
Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition","attachment; filename=document.pdf"); Response.TransmitFile( Server.MapPath("~/files/document.pdf") ); Response.End();
Mark's blog: developMENTALmadness.blogspot.com
-
Use the content-disposition header like this:
Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition","attachment; filename=document.pdf"); Response.TransmitFile( Server.MapPath("~/files/document.pdf") ); Response.End();
Mark's blog: developMENTALmadness.blogspot.com
Hi I have done this and the Open and Download works fine. But if I click on the next link on my original Web part (MOSS2007) then it does not even do a Postback. If I refresh the page and click on the next link it opens correctly. Any thoughts? Thanks