This can also be done without creating a handler.
//get the image from the database as byte array
byte[] image = (byte[])dr["image"];
//set the ImageUrl of the Image Control as a Base64 string
Image1.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(image)
Or if you want the with and height also, create an Image
by using a MemoryStream
and get the image properties.
using (MemoryStream ms = new MemoryStream(image))
{
System.Drawing.Image imageFromDB = System.Drawing.Image.FromStream(ms);
Image1.ImageUrl = "data:image/jpeg;base64," + Convert.ToBase64String(image);
Image1.Width = imageFromDB.Width;
Image1.Height = imageFromDB.Height;
}