Dear code master, I believe you all doing well.
I am writing an application where I uploaded a pdf file as varbinary(Max) this work file.
I want the user to view the pdf file first before downloading, when I run the application and click the button I get the pdf viewer inline but it display’s “Failed to load PDF document”.
My code is shown below:
- var DT = new DataTable();
- DT = ConnectAll.DownloadFile(TextBox1.Text.Trim());
- foreach (DataRow r in DT.Rows)
- {
- byte[] myFile = (byte[])r["docu"];
- Response.Clear();
- Response.Buffer = true;
- Response.ContentType = "application/pdf";
- Response.AddHeader("content-disposition", "inline;filename=MME.pdf");
- Response.Charset = "";
- Response.Cache.SetCacheability(HttpCacheability.NoCache);
- Response.BinaryWrite(myFile);
- Response.End();
- }
Can anybody help me ?
Thank you all

Manav PandyaPosted May 12, 2017, 12:11 AM
Abraham OlatubosunPosted May 12, 2017, 1:53 AM
Abraham OlatubosunPosted May 11, 2017, 11:17 PM
Rahul PrasadPosted May 11, 2017, 9:27 PM