Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pdf ContentType not displaying

Status
Not open for further replies.

mwa

Programmer
Jul 12, 2002
507
US
I have an application that uses the following to display a PDF document:
Code:
MyFileStream = New FileStream(HttpContext.Current.Session("filePath"), FileMode.Open, FileAccess.Read, FileShare.Read)

            FileSize = MyFileStream.Length

            Dim Buffer(CInt(FileSize)) As Byte
            MyFileStream.Read(Buffer, 0, CInt(FileSize))
            MyFileStream.Close()

            HttpContext.Current.Response.ContentType = "application/pdf"
            HttpContext.Current.Response.OutputStream.Write(Buffer, 0, FileSize)
            HttpContext.Current.Response.Flush()
            HttpContext.Current.Response.Close()

This works for most users, but I have a few users that report that they get a File Download dialog with the message:
"Do you want to save this file, or find a program online to open it?" It then lists
Name: Export.aspx
Type: Unknown File Type
From: myWebsiteUrl.com

Any ideas how to resolve this issue for these specific users? All are using Windows XP, Reader 7+, and IE7+

Thanks!

mwa
<><
 
Code:
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=[put name of file here].pdf");

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top