I have a "Download PDF" button that render a ReportViewer and open it in browser using Adobe Reader.
Here's the code:
Warning[] warn = null;
String[] streamids = null;
String mimeType = "application/pdf";
String encoding = String.Empty;
String extension = String.Empty;
Byte[] byteViewer;
byteViewer = report.LocalReport.Render("pdf", null, out mimeType, out encoding, out extension, out streamids, out warn);
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline; filename=" + fileName + ".pdf");
Response.BinaryWrite(byteViewer);
Response.Flush();
Response.End();
But now, instead of opening the pdf, i want to open a download dialog to download the file. What changes in the code should I do?
@edit The answers in that question are way too extensive, my question was asked to simplify the process of downloading a ReportViewer, and also adding a reference for future C# programmers that may encounter this question, without having to dig through lines of useless php code to find the answer.