问题描述:

I have a web application (ASP.NET 4.0/C#) that allows the user to upload PDF files into the database (as Byte[]). When the user wants to view this PDF they select a link which calls a LoadDocument() function that returns the file in a Byte[].

private void createPDF(byte[] file, string Name)

{

int fileSize = file.Length;

Response.AppendHeader("content-length", fileSize.ToString());

Response.ContentType = "application/pdf";

if (!Name.Contains("."))

Name = Name + ".pdf";

Response.AddHeader("Content-Disposition", "attachment; filename="+ Name);

Response.BinaryWrite(file);

Response.Clear();

Response.Flush();

Response.End();

}

This was working fine, but once the website changed to SSL (it was running off of basic http for a while) I am now getting errors that say "Adobe Reader could not open 'Certificate[2].pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

This all happened around the time that 1)The site was changed to SSL 2)The network forced an upgrade to Adobe Reader X. How can I fix this?

EDIT: I have updated the code a bit thanks to suggestions below, still no avail though.

相关阅读:
Top