如何在图像控件中显示其路径存储在数据库中的图像。请向我提供示例代码,我已经从数据库中获取了路径,但是如何在图像控件中显示。这是我的代码
[HttpPost]
public ActionResult DisplayPic()
{
string UserName=User.Identity.Name;
var getPath = from p in Session.Query<Registration>()
where p.Email == UserName
select p.Path;
if (getPath.Count() > 0)
{
//display pic???
}
return View();
}
看法:
@{
ViewBag.Title = "DisplayPic";
}
<h2>DisplayPic</h2>
@using (Html.BeginForm())
{
<img alt="" src="" width="200" height="200" />
}