1

In my app i displaying PDF files. Everything work fine expect one. When i hit save button in Browser PDF Viewer the default name of file is take from name of the method :

My code :

    public ActionResult PdfViewer(Criteriacriteria)
    {
        var report= new Report().GetReport(criteria);

        if (report!= null)
        {
            string mimeType = "";
            Response.AddHeader("content-disposition", string.Format("inline; filename=Test_'{0}'",DateTime.Now));
            return File(report, "application/pdf", "Test");
        }
           return Content("No report found upon given parameters");

    }   

The pdf displaing correct but when i saving it the default name is PdfViewer. As you can see in code i tried to change this name but whit no result. any idea ?

Thanks

Edit :

try to add code :

            var cd = new System.Net.Mime.ContentDisposition
            {
                // for example foo.bak
                FileName = "test",

                // always prompt the user for downloading, set to true if you want 
                // the browser to try to show the file inline
                Inline = true,
            };
            Response.AppendHeader("content-disposition", cd.ToString());

With no result

Aht
  • 583
  • 4
  • 25

0 Answers0