I have a fairly simple Action in an MVC3 application that should render an image...
public FileStreamResult Photo(int id)
{
//get the raw bytes for the photo
var qry = from p in db.Photos
where p.PhotoID == id
select p.PhotoData;
var data = qry.FirstOrDefault();
var mem = new MemoryStream(data);
var fs = new FileStreamResult(mem, "image/jpeg");
return fs;
}
When i run this i get a blank document in Chrome, Firefox displays the URL in the actual document area and IE renders the raw bytes.
Chrome gives me a message: Resource interpreted as Document but transferred with MIME type image/jpeg
This suggests to me that the stream data is not being sent to the browser and it is in fact receiving an empty document, but IE suggests the opposite.
Anyone come across this before, or know how to get around it?