0

I have an ASP page that fetches a PDF image from another URL and streams it to the browser. It appears to have stopped working somewhat recently (there were a few dozen Windows and .NET security patches installed on 8/23 which I think might be the cause).

The code is dead simple, and it works fine in Chrome. In IE8, my page loads fine and no errors are being logged. But the PDF data is not getting streamed. Can anyone see anything that might be causing IE an issue?

Dim objRequest
Set objRequest = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
objRequest.open "GET", otherUrl, False
objRequest.send
if left(objRequest.status,1) = 4 or left(objRequest.status,1) = 5 then 'their URL had a problem
    'return error to web page; this line is not hit
else
    Response.ContentType = "application/pdf"
    Response.BinaryWrite objRequest.responseBody
end if
Set objRequest = Nothing

I have left the part where I construct otherUrl but that seems to be working fine, I can hit the URL and get a PDF. I have played around with versions of the MSXML object but this seems to be the correct one to use and the ProgId is definitely available.

Help!

UPDATE with requested info: IE8, Adobe Reader X. Server OS is Windows Server 2k8 R2 Standard. IE9, Firefox and Chrome all seem to work fine for this.

Don Zacharias
  • 1,544
  • 2
  • 14
  • 31
  • Code looks fine. Could be Microsoft messing up with the FindMimeFromData function again. Does a download start if you disable the PDF reader plugin? The security patches you refer to.. were these on your client or server? – AardVark71 Sep 07 '12 at 07:46

2 Answers2

0

Actually hard to say anything without knowing your Adobe, IE and webserver version.. You can check here for basic tips.

If it’s crucial for you to get this working again, you might want to provoke a download prompt by adding this

Response.AppendHeader("content-disposition", "attachment;filename=myfile.pdf");
AardVark71
  • 3,928
  • 2
  • 30
  • 50
  • Tried the force attachment header, and I get "Internet explorer was unable to open this site" in IE. – Don Zacharias Sep 07 '12 at 20:55
  • Ok, sounds like this is out of my league too (don't have any experience with 2k8R2). There's one Microsoft kb article on IIS7, did you see that already ? http://support.microsoft.com/kb/979543 – AardVark71 Sep 08 '12 at 06:43
  • Can't help any further than suggesting to ___ Disable the "Display PDF in browser" option in Adobe Reader (while debugging only) and to ___ Set your content-length (not tested, but should be something like this Response.AddHeader("Content-Length", objRequest.responseStream.GetBuffer().Length) ) – AardVark71 Sep 08 '12 at 06:51
  • Thanks! The KB article might explain why it works OK in Chrome and Firefox (I didn't realize FF now has a native viewer) but I have been trying it with and without the PDF toolbar active. – Don Zacharias Sep 10 '12 at 22:33
0

Is your IIS configured to user HTTP-compression on all data sent? Sometimes this can mess with the browser not understanding it anymore at the receiving end.

Jeff
  • 736
  • 5
  • 14
  • Dynamic compression module is not installed, and static compression is checked. I went to a non prod copy of the site and unchecked it but the problem is still there. But it (presumably) always was set this way and this worked OK until recently. – Don Zacharias Sep 07 '12 at 20:32