0
我需要顯示數據庫中的圖像。 在控制器:從數據庫中顯示圖像
public ActionResult Display(int id, Document doc)
{
byte[] byteArray = doc.Content;//its has the image in bytes
return new FileStreamResult(new System.IO.MemoryStream(byteArray), "image/jpeg");
}
在View:
@foreach (var imgsrc in Model.ImagesSrc)
{
<img src="@Url.Action("Display", "image", new { id = @imgsrc.Id })" alt="" />
}
它不工作
「這不工作」不足以描述發生的情況。請閱讀http://tinyurl.com/so-hints –
在輸出它顯示帶問號的圖像 – user930453
所以你試圖下載正在服務的文件?用Wireshark看網絡流量?你試過什麼樣的診斷? –