bytearray to image asp.net

Another thing you can do which is quicker would be to not use the asp.net Image control and use the basic img element in html. So within your asp.net page, create a img element with an id of img and runat set to server.

Then you could do something like this:

<img id="img" runat="server" alt=""/>

public DataRow ClaimPhotoRow { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
    img.Src = "data:image/jpg;base64," + Convert.ToBase64String((byte[])ClaimPhotoRow[0]);

}

Leave a Comment