public FileResult DownloadFile()
{
return File("~/Content/lazzycoder.pdf", "application/pdf", "lazzycoder.pdf");
}
If you provide the third parameter (file name), ASP.NET MVC adds Content-Disposition: attachment; to the response. This forces the browser to download the file, instead of showing it inline (e.g. PDFs).