Trying to stream PDF to IE!

B

Brent

Problems streaming PDF back to Internet Explorer are well-described here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q305153

The solution, however, is elusive. I thought I was supplying all the
required info with my code*, but it still doesn't work. Any help would
be much appreciated!

--Brent

*Code Snippet
======================================

path = @"c:\pathIsHere\";
filename = "filename.pdf";

long StartPos = 0, FileSize;
FileInfo fi = new FileInfo(path + filename);
FileSize = fi.Length;

Response.ClearContent();
Response.ContentType = "Application/pdf";
Response.AddHeader("Content-Disposition","Filename="+filename);
Response.AddHeader("Content-Length",FileSize.ToString());
Response.WriteFile(path + filename, StartPos, FileSize);
Response.End();
 
B

Bruce Barker

to work in all cases with IE, the url should end in pdf. write an asp.net
module, and map the pdf extension to it. then use url rewriting to run the
correct asppage. or handle in module.

you want the url to look like (say retreving doc id 101)

http://mysite/mydocs/101.pdf

then rewrite to showpdf.aspx?id=101


-- bruce (sqlwork.com)
 

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