I have pdfExport class where I generate a pdf. In this class I have a method
public MemoryStream returnPDF()
{
using (MemoryStream stream = new MemoryStream())
{
pdfRenderer.PdfDocument.Save(stream, false);
return stream;
}
}
My controller looks as follows
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult Contingency_Report(List<int> ids)
{
pdfExport pdf = new pdfExport(ids);
MemoryStream stream = new MemoryStream();
stream = pdf.returnPDF();
return File(stream.ToArray(), "application/pdf", "contingency.pdf");
}
As I can see in Chrome (F12 key is pressed), the response returns pdf (the Response tab), but the file is not available for download. Nothing happens till I see results in Response tab. How to make it available for download? I want the browser ask where to save file.