Hi PatLaf,
Thanks for your followup and the code you provided. From your code I found
that you use
Response.ContentType = "Application/pdf"
Response.WriteFile( filepath) .
to show the pdf to client.
And this code block is called in a button's post back event. I think you
need to first clear all the original headers and content before you set the
Response.ContentType and write the pdf file to the output stream. Also, use
Response.End to endup the Response operation after write file. Here is the
code I used:
----------------------------------------------------
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnShow.Click
If txtFilename.Text.Length > 0 Then
Dim strPath As String
' change the path according to your web folder structure
strPath = Server.MapPath("PDF/") + txtFilename.Text
If System.IO.File.Exists(strPath) Then
'do clear operation
Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.ContentType = "Application/pdf"
' add the below sentense if you want to force the client to
open a file open dialog
Response.AddHeader("content-disposition", "attachment;
filename=" + txtFilename.Text)
Response.WriteFile(strPath)
'End the response stream
Response.End()
Else
lblMessage.Text = "Invalid filename!"
End If
Else
lblMessage.Text = "Please enter filename!"
End If
End Sub
----------------------------------------------------
Also, I've attached the whole test page I used on my side which worked
well. You may have a try on it to see if it works on side.
In addition, I've found that you've posted two new thread on this issue and
some other community members and MSFT member have also replied you in
those. Please also have a look to see whether those help. If you have
anything unclear or any further problems, please feel free to post here or
in those threads.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx