.NET MVC,浏览器端访问图片链接直接下载而不是查看

发布时间 2023-09-19 15:17:10作者: 奇迹之耀

 

去掉文件名即可

public ActionResult Image()
{
string filePath = "D:\\123.png";
//return File(CommonHelper.GetImage(filePath), "image/png","123.png");//这种写法是错误的
return File(CommonHelper.GetImage(filePath), "image/png");
}