title: How do I get a querystring into ashx file in c#
body: <p>I have been checking the internet and there is one answer here at stackoverflow, but it is in vb.net, and I am using c#,</p>
  
  <p>k, this is the deal, I have a binary image stored in a sql server db.  I have that working great, to load it in and also to retieve it. In a gridview, I have a link for the detail of the master/detail page.  I am using a simple html image tag in the html part here is the code:</p>
  
  <p>I am using VS2010 and C#</p>
  
  <p>(displayDetail02.aspx)</p>
  
  <pre><code>&lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;div&gt;
    &lt;img id="Img1" width="500" 
                 runat="server" 
                 src="~/getLargeImage.ashx?Businessid=&lt;%Eval(businessid)%&gt;"
                 alt="Business Image" 
                 style="border: 1px inset"/&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Here is the code behind:</p>
  
  <pre><code>public partial class displayDetail02 : System.Web.UI.Page
  {
     public string businessid = string.Empty;
  
     protected void Page_Load(object sender, EventArgs e)
     {
        if (!Page.IsPostBack)
        {
          businessid = Request.QueryString["businessid"];
        }
     }
  }
  </code></pre>
  
  <p>(getLargeImage.ashx)</p>
  
  <pre><code> public partial class getLargeImage : IHttpHandler {
  
  
   public void ProcessRequest(HttpContext context)
   {
      HttpContext _context = HttpContext.Current;
      context.Response.ContentType = "image/jpg";
      string businessid = Convert.ToString(context.Request.QueryString["businessid"]);    
  
    ...
  </code></pre>
  
  <p>My problem is the querystring variable, I have tried many many different ways to format the querystring coming from displayDetail02.aspx, but I can't seam to get the ' and " right to display the paramater, I keep getting '&lt;%' which is the first part of query string.</p>
  
  <p>I look at it in firebug in mozilla and the querystring is getting passed correctly, but it is not getting processed in the ashx file correctly.</p>
  
  <p>I also tried it in the code behind etc, like here is some of the code I have tried.</p>
  
  <pre><code>&lt;% --src='&lt;%# "getLargeImage.ashx?Businessid=" + Eval("Businessid") %&gt;' --%&gt;
  </code></pre>
  
  <p>It is just one line of code ...  oh, I know this works, because when I hardcode a parameter in the ashx (generic handler), I get the image back</p>
  
  <p>Could someone please help me?</p>