I'm downloading a PDF file using migradoc in my asp.net application :
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=Reports_" + _title + ext);
using (MemoryStream ms = new MemoryStream())
{
pdfRenderer.Save(ms, false);
byte[] buffer = new byte[ms.Length];
ms.Seek(0, SeekOrigin.Begin);
ms.Flush();
ms.Read(buffer, 0, (int)ms.Length);
HttpContext.Current.Response.BinaryWrite(ms.ToArray());
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
}
The problem is that the PDF is opened in acrobat reader aswell as being downloaded to my computer. I would like if it would only be downloaded to my computer but not opened in acrobat reader.
Any help is appreciated, I couldn't find any information related specifically to this problem.