I haven't been able to get this to work using answers to other similar questions, maybe this case is different.
I'm trying to turn a byte array into an image using asp.net and mvc.
Here's my view:
<div class="carousel-item">
<img class="d-block w-100" src="@Url.Action( "Show", "Home", new { id = i.ProductID })" alt="@i.ProductName">
</div>
Here's the Show method in my controller:
public ActionResult Show(int id)
{
IQueryable<Product> products = from p in db.Products
where id == p.ProductID
select p;
var imageData = products.First().Picture;
return File(imageData, "image/jpg");
}
If anybody could clue me in to what I'm doing incorrectly here, that would be great.
Edit I have tried turning the byte array into a base64 string as the answers of the "possibly duplicate" question directed to do, however that did not render as an image.