title: ASP.NET dynamic image url using server tags
body: <p>I am trying to set the ImageUrl using the following code...</p>
  
  <pre><code>&lt;asp:Image ID="brokenImage" runat="server" AlternateText="Coded path" ImageUrl='~/headerImages/&lt;%= getImage(Request.QueryString["Id"]) %&gt;'/&gt;
  </code></pre>
  
  <p>Eliminating the opening tag and viewing the browser ouput alongside an image tag that is explicitly written produces the following results....</p>
  
  <pre><code>asp:Image ID="brokenImage" runat="server" AlternateText="Coded path" ImageUrl='~/headerImages/images (3).jpg' /&gt;
  
  asp:Image ID="workingImage" runat="server" AlternateText="Explicit Path" ImageUrl="~/headerImages/images (3).jpg" /&gt; 
  </code></pre>
  
  <p>Why is the first image not displaying but the second is? How can I pass a parameter to the code behind and set the url?</p>