I am using Visual Studio 2010. I have created several PDFs using Adobe Acrobat Standard 9.
I am trying to force the download of the selected PDF to the user's local machine.
I am using an asp.imagebutton to trigger the code behind that first updates the SQL database with the info about the download and then calls a Public sub: ForcePDF Download.
However when the code is run it returns a usless error that tells me there was an error.
Here is the Download code I am using:
Public Sub ForcePDFDownload(ByVal Response As HttpResponse, ByVal FullVirtualPath As String, ByVal fileName As String)
Response.ContentType = "application/octet-stream"
Response.Charset = "UTF-8"
Response.AddHeader("content-disposition", "attachment; filename=" & fileName)
It is important that the file be downloaded to the clients local machine rather that simply send the PDF to a browser window. I have tried substituting "application/pdf" for the ContentType with the same reasults. The filename is simply the PDF name, i.e. Book1.pdf
The FullVirtualPath is sent from the calling codebehind and is obtained using:
View Complete Post