title: Transfer data from ashx to aspx. Make asp image control identify which image to show - asp.net c#
body: <p>page.aspx.cs code:</p>
  
  <pre><code>HttpContext.Current.Session["id1"] = id1.ToString();
  Server.Transfer("Handler.ashx"); //Getting error
  Image1.ImageUrl = "~/Handler.ashx?ID=" + id1.ToString();
  
  HttpContext.Current.Session["id2"] = id2.ToString();
  Server.Transfer("Handler.ashx"); //Getting error
  Image2.ImageUrl = "~/Handler.ashx?ID=" + id2.ToString();
  </code></pre>
  
  <p>Handler.ashx code:</p>
  
  <pre><code>public void ProcessRequest(HttpContext context)
  {
      int id = Convert.ToInt32(context.Session["id1"]);
      byte[] IMG = class.ReadImg(id);
      context.Response.ContentType = "image/jpg";
      context.Response.BinaryWrite(IMG);
  }
  public void ProcessRequest2(HttpContext context2)
  {
      int id = Convert.ToInt32(context2.Session["id2"]);
      byte[] IMG2 = class.ReadImg(id);
      context2.Response.ContentType = "image/jpg";
      context2.Response.BinaryWrite(IMG2);
  }
  </code></pre>
  
  <p>page.aspx code:</p>
  
  <pre><code>&lt;asp:Image ID="Image1" runat="server" /&gt;//How to define thats gonna show image of id1
  &lt;asp:Image ID="Image2" runat="server" /&gt;//How to define thats gonna show image of id2
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <ol>
  <li>I'm not able to transfer data from page.aspx to Handler.ashx</li>
  <li>I dont know how to make <code>Image</code> element to identify which image it should show according to the id (maybe some <code>request.queryString</code> magic I don't understand)</li>
  </ol>
  
  <p>Help!!
  Thanks :]</p>