Change the method imageToByteArray like below.
C#
public string imageToByteArray(System.Drawing.Image imageIn)
{
byte[] bytes = (byte[])(new ImageConverter()).ConvertTo(imageIn, typeof(byte[]));
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
return base64String;
}
Then populate the image control.
jpg.Save("result.jpeg", ImageFormat.Jpeg);
string url = imageToByteArray(jpg);
Image1.ImageUrl = "data:image/png;base64," + url;
con.Close();