Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Display PDF file With Response.Write file ????

0 views
Skip to first unread message

Fabrice Meichtry

unread,
Sep 23, 2002, 2:53:32 PM9/23/02
to
HI,

I'm a newbie in ASP and ASP .net and I'm trying to display a PDF
file with ADOBE plugin in a ASP .net page.

I always get a message from IE that he wants to open mypage.aspx
then it open with another program. I tried to set all .aspx file extension
to be open with IE but nothing happens..

Here my code :

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Page.IsPostBack = False Then
Response.WriteFile("c:\tmp\manual.pdf")
Response.ContentType = "application/pdf"
End If
End Sub

Thanks..

Fabrice


Peter O'Reilly

unread,
Sep 23, 2002, 4:35:23 PM9/23/02
to
1) Move the Response.ContentType before the Response.Write statement
2) Double check the ContentType value set to make sure it is correct for
ADOBE PDF.

If it still does not work after that , then...
3) Add the following code immediately after the Response.ContentType code:
Response.AddHeader("content-disposition", "attachment; filename=manual.pdf")

Hope this helps.
--
Peter O'Reilly


0 new messages