PDF returning a corrupt file

yamwixwih

New Member
I am using the following bit of code to send a pdf file back to the user. this works fine on my pc and on all of our test pcs. however the user is complaining the document is corrupt. When I look at the pdf file sent back in notepad I can see some HTML after the binary infomation.\[code\]protected void btnGetFile_Click(object sender, EventArgs e) { string title = "DischargeSummary.pdf"; string contentType = "application/pdf"; byte[] documentBytes = GetDoc(DocID); Response.Clear(); Response.ContentType = contentType; Response.AddHeader("content-disposition", "attachment;filename=" + title); Response.BinaryWrite(documentBytes); }\[/code\]
 
Back
Top