下面是我尝试过的代码。但是它没有显示图像而不是替代文本
控制器
while (reader.Read())
{
var img = new image();
{
img.images = (byte[])reader["img"];
ViewBag.Base64String = "data:image/png;base64," + Convert.ToBase64String(img.images, 0, img.images.Length);
}
tlist.Add(img);
}
ViewBag.s = tlist;
查看
@foreach(var item in ViewBag.s)
{
string s="data:image/png;base64,"+ Convert.ToBase64String(item.images, 0, item.images.Length);
<img src="@s" width="150" height="100" />
}