I am trying to send a PDF to the browser from a memorystream and set the filename using the content-disposition of type inline.
The file will load into the browser via the Adobe plugin but when I click to save the PDF, the filename is not what I have specified in the header. Instead the filename is the .Net module + “.PDF” which sent the pdf through the response.
For instrance mytest.aspx is called and sends back the PDF through the response and it loads in the Adobe plugin. I click to save the file but the filename is mytest.pdf instead of ReportFile.PDF.
Dim fs As New MemoryStream
fs = Current.Session("rptStream")
Dim buffer(fs.Length) As Byte
If fs.Length > 0 Then
fs.Position = 0
fs.Read(buffer, 0, fs.Length)
Current.Response.Buffer = True
Current.Response.ContentType = "application/pdf"
Current.Response.AppendHeader("Content-Disposition", "inline; Filename=\""" & “ReportFile.PDF” & "\""")
Current.Response.OutputStream.Write(fs.GetBuffer(), 0, fs.Length)