title: How to display an image in a User Control inside a Web Form using Byte Array?
body: <p>Here is the code, the problem is that the image is displayed but after clearing all the page, i need it to be drawn inside the user control that is inside the web form.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
  
          if (Session["ObjHoteles"] == null)
          {
              Label1.Text = "select hotel first please.";
          }
          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.ContentType = "image/jpeg";
                  Response.Expires = 0;
                  Response.OutputStream.Write(Foto, 0, Foto.Length);
                  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 display the image where the user control is located inside the web form. Not in a new page.</p>
  
  <p>I need to use a User Control it was specifically requested by my client.</p>