<img src='/Data/GetImage?MetadataID=2223'/> public FileContentResult GetImage(Int64 MetadataID = 0) { BLL.Metadata metadata = new BLL.Metadata(); Model.Metadata m = metadata.GetModel(MetadataID); if (m != null && m.Thumbnail != null && m.ThumbnailType != null) { return File(m.Thumbnail, m.ThumbnailType); } else { byte[] buffer; using (FileStream fs = new FileInfo(Server.MapPath("/images/nopicture.png")).OpenRead()) { buffer = new byte[fs.Length]; fs.Read(buffer, 0, Convert.ToInt32(fs.Length)); } return File(buffer, "image/png"); } }