Hi all misters,
I hope someone can help me here.
Here is my problem.
I stream the PDF files to the browser because they contain private
information and they are not located within the web site itself. The
application opens the PDF file and then streams it to the browser. I call to
ASPX page like this: ShowFile.aspx?I DFILE=100&NAME= 000040.pdf.
The aspx page calls WCF service and gets all bytes of a PDF file.
When streams bytes of PDF file to browser, Acrobat Reader OCX reads bytes
and shows PDF, the user can save PDF to disk file with a name.
I want that the filename could be the NAME querystring parameter.
I try but doesn't works fine.
Here is the code that I use:
Thanks for any help you can offer, thanks in advance, any help will be very
grateful, regards, greetings
Response.Buffer = True '//<<- Va con el Response.Flush( );
'Response.Buffe rOutput = True
Response.Clear( )
Response.ClearC ontent()
Response.ClearH eaders()
'Response.Cache Control = "Private" 'Public
Response.AddHea der("Accept-Header", tamanoFichero.T oString())
Response.AddHea der("Content-Size", tamanoFichero.T oString())
Response.AddHea der("Content-Length", tamanoFichero.T oString())
Dim abrirEnAcrobatR eader As Boolean = False
If abrirEnAcrobatR eader Then
' AparecerÃa un cuadro de diálogo para Abrir o Guardar fichero
Response.AddHea der("Content-Disposition", "attachment ; filename=" +
Path.GetFileNam e(nombreFichero ))
Else
Response.AddHea der("Content-Disposition", "inline;filenam e=" + nombreFichero)
End If
'Response.AddHe ader("Content-Disposition", "attachment ; filename=" & fn)
'Response.AddHe ader("Content-Disposition", "attachment ; filename=" & fn & ";")
'Response.AddHe ader("Content-Disposition", "inline; filename=" & fn)
'Response.AddHe ader("Content-Disposition", "inline; filename=" & fn & ";")
'Response.AddHe ader("Content-Disposition", "filename=" & fn)
'Response.AddHe ader("Content-Disposition", "filename=" & fn & ";")
Response.AddHea der("Expires", "0")
Response.AddHea der("Pragma", "cache")
Response.AddHea der("Cache-Control", "private")
'//Set the output stream to the correct content type (PDF).
Response.Conten tType = sMimeType
'Response.AddHe ader("Content-Type", sMimeType)
Response.AddHea der("Accept-Ranges", "bytes")
Response.Charse t = ""
Response.Binary Write(infoFiche ro.ContenidoFic hero)
Response.Flush( )
'Response.Write File(fichero)
'Response.Close ()
Response.End()
--
I hope someone can help me here.
Here is my problem.
I stream the PDF files to the browser because they contain private
information and they are not located within the web site itself. The
application opens the PDF file and then streams it to the browser. I call to
ASPX page like this: ShowFile.aspx?I DFILE=100&NAME= 000040.pdf.
The aspx page calls WCF service and gets all bytes of a PDF file.
When streams bytes of PDF file to browser, Acrobat Reader OCX reads bytes
and shows PDF, the user can save PDF to disk file with a name.
I want that the filename could be the NAME querystring parameter.
I try but doesn't works fine.
Here is the code that I use:
Thanks for any help you can offer, thanks in advance, any help will be very
grateful, regards, greetings
Response.Buffer = True '//<<- Va con el Response.Flush( );
'Response.Buffe rOutput = True
Response.Clear( )
Response.ClearC ontent()
Response.ClearH eaders()
'Response.Cache Control = "Private" 'Public
Response.AddHea der("Accept-Header", tamanoFichero.T oString())
Response.AddHea der("Content-Size", tamanoFichero.T oString())
Response.AddHea der("Content-Length", tamanoFichero.T oString())
Dim abrirEnAcrobatR eader As Boolean = False
If abrirEnAcrobatR eader Then
' AparecerÃa un cuadro de diálogo para Abrir o Guardar fichero
Response.AddHea der("Content-Disposition", "attachment ; filename=" +
Path.GetFileNam e(nombreFichero ))
Else
Response.AddHea der("Content-Disposition", "inline;filenam e=" + nombreFichero)
End If
'Response.AddHe ader("Content-Disposition", "attachment ; filename=" & fn)
'Response.AddHe ader("Content-Disposition", "attachment ; filename=" & fn & ";")
'Response.AddHe ader("Content-Disposition", "inline; filename=" & fn)
'Response.AddHe ader("Content-Disposition", "inline; filename=" & fn & ";")
'Response.AddHe ader("Content-Disposition", "filename=" & fn)
'Response.AddHe ader("Content-Disposition", "filename=" & fn & ";")
Response.AddHea der("Expires", "0")
Response.AddHea der("Pragma", "cache")
Response.AddHea der("Cache-Control", "private")
'//Set the output stream to the correct content type (PDF).
Response.Conten tType = sMimeType
'Response.AddHe ader("Content-Type", sMimeType)
Response.AddHea der("Accept-Ranges", "bytes")
Response.Charse t = ""
Response.Binary Write(infoFiche ro.ContenidoFic hero)
Response.Flush( )
'Response.Write File(fichero)
'Response.Close ()
Response.End()
--
Comment