I have a Update Panel and other controls in my ASPX page.
After user selects few parameters and hit the submit button I am updating the database and I have a byteArray which gets populated.
When I run the application though the bytearray is getting populated, as the contentType is getting changed, it is throwing an error. Could you please let me know what I need to change to make it work.
byte[] doc=null;
doc=getByteArrayOfDocument(123);
if (doc != null)
{
Response.Clear();
Response.ContentType = "application/pdf";
Response.Charset = "";
Response.AddHeader("content-disposition", "inline; filename=doc.pdf");
Response.AddHeader("content-length", doc.Length.ToString());
Response.AddHeader("content-Transfer-Encoding", "binary");
Response.BinaryWrite(doc);
}
In order to modify the
Response, you need a PostBack not an AsyncPostBack. So either put anPostBackTriggeron theUpdatePanelfor the document view/download event, either put the action outside theUpdatePanel.