MVC下载(存在文件的情况)

前台:

<h1>下载</h1>
<button onclick="location = 'download'">下载</button>

后台:

 public ActionResult download()
        {

            return File(new FileStream(Server.MapPath("/upload/20150917145429221.png"), FileMode.Open), "application/octet-stream", "test.png");
        }

 

posted @ 2015-09-17 16:06  小小高  阅读(473)  评论(0编辑  收藏  举报