title: How to display image inside web form from Byte Array with C#
body: <p>This is my code, all it does is clear the web page and draw the image, so the rest of the form disappears! I need to show the image inside the form.</p>
  
  <p>This is my User Control to display the images:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
  
          if (Session["ObjHoteles"] == null)
          {
              Label1.Text = "Por favor, primero seleccione un hotel para desplegar las fotos.";
          }
          else
          {
              if (!IsPostBack)
              {
                  List&lt;Byte[]&gt; ArrayFotos = new List&lt;Byte[]&gt;();
                  string NombreDelHotel = "";
  
                  Hoteles Hotel1 = (Hoteles)Session["ObjHoteles"];
                  NombreDelHotel = Hotel1.NombreHotel;
  
                  ArrayFotos = Persistencia.PersistenciaFotos.FotosDeHotel(NombreDelHotel);
                  Session["CantFotos"] = ArrayFotos.Count();
  
                  Byte[] Foto = ArrayFotos[0];
  
                  Response.Buffer = true;
                  Response.Clear();
                  Response.ContentType = "image/jpeg";
                  Response.Expires = 0;
                  Response.BinaryWrite(Foto);
                  Session["NumFoto"] = 0;
              }
              else
              {
                  List&lt;Byte[]&gt; ArrayFotos = new List&lt;Byte[]&gt;();
                  string NombreDelHotel = "";
  
                  Hoteles Hotel1 = (Hoteles)Session["ObjHoteles"];
                  NombreDelHotel = Hotel1.NombreHotel;
  
                  ArrayFotos = Persistencia.PersistenciaFotos.FotosDeHotel(NombreDelHotel);
                  Session["CantFotos"] = ArrayFotos.Count();
  
                  Byte[] Foto = ArrayFotos[(int)Session["NumFoto"]];
  
                  Response.Buffer = true;
                  Response.Clear();
                  Response.ContentType = "image/jpeg";
                  Response.Expires = 0;
                  Response.BinaryWrite(Foto);
  
              }
          }
  </code></pre>
  
  <p>I need to find a way that doesnt clear all the page, just draw the image inside the user control.</p>