以图片为例

后台Controller.cs

public FileResult ImageUrl(string file)
{
return File("物理路径"+file, "image/png");

}

 

前台.cshtml

 

<img src='@Url.Action("ImageUrl", "控制器名称", new {h.file , area="区域名"})' alt="">

或者

<img src='@Url.Action("ImageUrl", "控制器名称", new {area="区域名"})?file=@h.file' alt="">

posted on   xs~ing  阅读(1257)  评论(0编辑  收藏  举报
努力加载评论中...

点击右上角即可分享
微信分享提示