http://stackoverflow.com/questions/5826649/returning-a-file-to-view-download-in-asp-net-mvc
public ActionResult Download() { var document = ... var cd = new System.Net.Mime.ContentDisposition { // for example foo.bak FileName = document.FileName, // always prompt the user for downloading, set to true if you want // the browser to try to show the file inline Inline = false, }; Response.AppendHeader("Content-Disposition", cd.ToString()); return File(document.Data, document.ContentType); }
and Remember to use news {target="_blank"} in ActionLink parameter
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-10 15:30:04