471,315 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,315 software developers and data experts.

PDF not downloaded in IE 6, 7, but Firefox works OK.

I'm trying to stream files back to the user's browser. Text and JPG
files seem to work fine, but I get nothing -- actually, the missing
photo icon with the red "X" -- when streaming PDF to Internet Explorer
6.x and 7 (beta). I'm hoping for some pointers with this code snippet:

===============================

path = @"c:\pathIsHere\";
filename = "filename.pdf";
Response.ClearContent();
Response.ContentType = "Application/pdf";
long StartPos = 0, FileSize;
FileInfo fi = new FileInfo(path + filename);
FileSize = fi.Length;
Response.AddHeader("Content-Disposition","Filename="+filename);
Response.WriteFile(path + filename, StartPos, FileSize);
Response.End();

===============================

The code works fine in Firefox, and for some other file types in most
browsers. But it kills PDF.

Thanks for any help!

--Brent
Feb 24 '06 #1
1 1170
Thus wrote Brent ""b b i g l e r y a h o o . c o m,
I'm trying to stream files back to the user's browser. Text and JPG
files seem to work fine, but I get nothing -- actually, the missing
photo icon with the red "X" -- when streaming PDF to Internet Explorer
6.x and 7 (beta). I'm hoping for some pointers with this code snippet:

===============================

path = @"c:\pathIsHere\";
filename = "filename.pdf";
Response.ClearContent();
Response.ContentType = "Application/pdf";
long StartPos = 0, FileSize;
FileInfo fi = new FileInfo(path + filename);
FileSize = fi.Length;
Response.AddHeader("Content-Disposition","Filename="+filename);
Response.WriteFile(path + filename, StartPos, FileSize);
Response.End();
===============================

The code works fine in Firefox, and for some other file types in most
browsers. But it kills PDF.


Try using TransmitFile() instead of WriteFile().

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by comp.lang.php | last post: by
13 posts views Thread by Giggle Girl | last post: by
11 posts views Thread by minnesotti | last post: by
9 posts views Thread by =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post: by
3 posts views Thread by SAL | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.