I am trying to respond to a client with a PDF stored in the MSSQL varbinary (MAX) field. The answer works on my local host and test server over the http connection, but does not work on the production server via the https connection. I am using just BinaryWrite (code below).
byte[] displayFile = DatabaseFiles.getPdfById(id);
Response.ContentType = "application/pdf";
Response.BinaryWrite(displayFile);
Nothing special here. Just take the binary data, set the content type and write back to the client. Is there anything special that needs to be done in order to respond to https in this way?
Change: . It doesn’t work, I mean that I get an empty document in the browser. Acrobat does not load in the browser.
Edit: I just noticed that this problem only occurs in IE 7. PDF loads correctly in Firefox 3. Our client only uses IE 7 (better than IE 6, which I convinced them to update from ... lol).
Change: . I tried adding the header "content-disposition" so that the file works as an attachment. Browser failed to load under SSL with IE error "Internet Explorer cannot load displayFile.aspx from ProductionServer.net". (Code below)
byte[] displayFile = DatabaseFiles.getPdfById(id);
Response.Clear();
Response.AddHeader("content-disposition", String.Format("attachment;filename={0}", fileName));
Response.ContentType = "application/pdf";
Response.BinaryWrite(displayFile);
Edit: If the file is viewed via http on the Production Server, the browser displays the code for the PDF as it is viewed through NotePad. (e.g.% PDF-1.4% âãÏÓ 6 0 obj <> endobj xref 6 33 ... etc.)
Eddie