PDF Streaming with IIS 6.0

D

Damien

Hi All,

I have got the code below working fine IIS 5.1, with both IE 5.5 sp2
and 6 as client browsers. When it runs under IIS 6.0, and with IE 5.5
sps2 it does not recognize the mine type, and attempts to save the PDF
file with a .aspx extension. The PDF file is not corrupt, only the
file extension is wrong.

I have installed all of the MS patches for IE 5.5 sp2 as applicable.
Both HTTP responses look almost identical (except for server version
and datetime).

Acrobat Reader 5.0 is installed on both servers, with PDF mine type
registered as "application/pdf". Static pdf files can be requested for
either server without a problem.

Files of various types (including PDF, txt and csv) seems to stream
correctly, i.e. the end file on the client is not corrupt, but it only
seems to be the extension that is invalid in IE 5.5 SP2 only, which is
..aspx. The full code does do a Response.Clear(), buffering is on and
not IIS web handlers or ISAPI filters are installed.

My big question is why does it work under IIS 5.1 and not IIS 6.0?
That is, IE 6 works fine with both IIS versions, yet IE 5.5 SP2 only
seems to work on IIS 5.1 (running on both Win2k and WinXp) and not on
IIS 6.0 (on Win 2003 Server)

Response.Clear();
Response.AddHeader("content-disposition",
@"attachment;filename=""google.pdf""");

Response.ContentType = "application/pdf";

string file = Server.MapPath("File/google.pdf");
Response.WriteFile(file);
Response.Flush();

Thanks,
Damien
 
J

john farrow

Try adding

Response.AddHeader( "content-length", [length of file] )

Some versions of IE seem to need this so they know when to stop waiting for
the server to send more data.


Visual Programming Ltd mail PO Box 22-222, Khandallah, Wellington, New
Zealand site Level 2, 2 Ganges Road, Khandallah, Wellington, New Zealand
phone +64 4 479 1738 fax +64 4 479 1294 web http://www.xmlpdf.com
 
D

Damien

John,

Thanks for your suggestion, but I had already tried the content length
header with no sucess.

Thanks, Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top