Using a .NET MVC Controller Action as the Source for an HTML <img>
- by Jimbo
I'm trying to display the picture associated with a user in my database (the picture field's data type is image) on a page - unfortunately the code below fails to do that.
HTML
<img src="/User/Picture/1" />
Controller Action
public byte[] Picture(int id){
UserRepository r = new UserRepository();
return r.Single(id).logo.ToArray();
}