1

so i am trying to open a file inline in Internet Explorer. This works perfectly but the problem is when i save it it uses the Name of the Method and not the name given to the content disposition.

var cd = new System.Net.Mime.ContentDisposition
                    {
                        FileName = formLanguage.FileName,
                        Inline = formLanguage.FileExtension == FileExtension.PDF

                    };

                    Response.Headers.Add("content-disposition", "inline; filename=" + cd.FileName);

                    AddDownloadedForm(formLanguage.Id);
                    return File(hBytes, type);

  • Does this answer your question? [Content-Disposition:What are the differences between "inline" and "attachment"?](https://stackoverflow.com/questions/1395151/content-dispositionwhat-are-the-differences-between-inline-and-attachment) – vicpermir Feb 18 '20 at 12:24
  • Try to use `Response.Headers.Add("content-disposition", "attachment;filename=");` to download the file first, if success, modify the code as below: `Response.Headers.Add("content-disposition", "attachment;filename=" + cd.FileName);`. – Zhi Lv Feb 19 '20 at 10:15
  • 1
    That would work, but i want it inline with the correct filename, not as attachment... – Benjamin Stucki Feb 19 '20 at 10:43

0 Answers0