A
Alhambra Eidos Kiquenet
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?IDFILE=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.BufferOutput = True
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
'Response.CacheControl = "Private" 'Public
Response.AddHeader("Accept-Header", tamanoFichero.ToString())
Response.AddHeader("Content-Size", tamanoFichero.ToString())
Response.AddHeader("Content-Length", tamanoFichero.ToString())
Dim abrirEnAcrobatReader As Boolean = False
If abrirEnAcrobatReader Then
' AparecerÃa un cuadro de diálogo para Abrir o Guardar fichero
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Path.GetFileName(nombreFichero))
Else
Response.AddHeader("Content-Disposition", "inline;filename=" + nombreFichero)
End If
'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn)
'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn & ";")
'Response.AddHeader("Content-Disposition", "inline; filename=" & fn)
'Response.AddHeader("Content-Disposition", "inline; filename=" & fn & ";")
'Response.AddHeader("Content-Disposition", "filename=" & fn)
'Response.AddHeader("Content-Disposition", "filename=" & fn & ";")
Response.AddHeader("Expires", "0")
Response.AddHeader("Pragma", "cache")
Response.AddHeader("Cache-Control", "private")
'//Set the output stream to the correct content type (PDF).
Response.ContentType = sMimeType
'Response.AddHeader("Content-Type", sMimeType)
Response.AddHeader("Accept-Ranges", "bytes")
Response.Charset = ""
Response.BinaryWrite(infoFichero.ContenidoFichero)
Response.Flush()
'Response.WriteFile(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?IDFILE=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.BufferOutput = True
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
'Response.CacheControl = "Private" 'Public
Response.AddHeader("Accept-Header", tamanoFichero.ToString())
Response.AddHeader("Content-Size", tamanoFichero.ToString())
Response.AddHeader("Content-Length", tamanoFichero.ToString())
Dim abrirEnAcrobatReader As Boolean = False
If abrirEnAcrobatReader Then
' AparecerÃa un cuadro de diálogo para Abrir o Guardar fichero
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Path.GetFileName(nombreFichero))
Else
Response.AddHeader("Content-Disposition", "inline;filename=" + nombreFichero)
End If
'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn)
'Response.AddHeader("Content-Disposition", "attachment; filename=" & fn & ";")
'Response.AddHeader("Content-Disposition", "inline; filename=" & fn)
'Response.AddHeader("Content-Disposition", "inline; filename=" & fn & ";")
'Response.AddHeader("Content-Disposition", "filename=" & fn)
'Response.AddHeader("Content-Disposition", "filename=" & fn & ";")
Response.AddHeader("Expires", "0")
Response.AddHeader("Pragma", "cache")
Response.AddHeader("Cache-Control", "private")
'//Set the output stream to the correct content type (PDF).
Response.ContentType = sMimeType
'Response.AddHeader("Content-Type", sMimeType)
Response.AddHeader("Accept-Ranges", "bytes")
Response.Charset = ""
Response.BinaryWrite(infoFichero.ContenidoFichero)
Response.Flush()
'Response.WriteFile(fichero)
'Response.Close()
Response.End()