473,394 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1206
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Razvan | last post by:
Hi ! I have a big problem with my web site www.mihaiu.name. Sometimes when I visit my page with IE6 the browser ask me to download the index.html file ! The options are open, save, cancel,...
6
by: Cliff R. | last post by:
Hi, I use a handy little Javascript Flash detection script on a number of sites (copied below). Usually works great, but I just started trying Firefox and it's not working. A few browsers are...
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
2
by: comp.lang.php | last post by:
class ReportGenerator { function ReportGenerator() {} /** * Generate the HTTP headers necessary for this file type. Can be called statically *
13
by: Giggle Girl | last post by:
Hi there, I am having a problem with the behavior of Firefox, where lefthand column content is not resized properly after it is "collapsed" and then "re-expanded". An online demo is available...
11
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
4
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load....
9
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post by:
I have a ASP .Net page that allows moving around items on the page through javascript. This page works fine in IE. In FireFox however, I have found that if the page is using XHTML 1.0...
3
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.