title: Embedded code in NavigateUrl of an asp:Hyperlink. What am I doing wrong?
body: <p>In code-behind of an ASP.NET page I have this method:</p>
  
  <pre><code>public string TestFunc()
  {
      return "http://www.blabla.net";
  }
  </code></pre>
  
  <p>And in markup this:</p>
  
  <pre><code>&lt;%= TestFunc() %&gt;
  </code></pre>
  
  <p>If I run the page I see "<a href="http://www.blabla.net" rel="nofollow noreferrer">http://www.blabla.net</a>" as text on the page and in debugger I enter TestFunc - all as expected.</p>
  
  <p>If I put this Hyperlink on the same aspx page...</p>
  
  <pre><code>&lt;asp:HyperLink ID="MyLink" runat="server" NavigateUrl='&lt;%= TestFunc() %&gt;'&gt;Proceed...
  &lt;/asp:HyperLink&gt;
  </code></pre>
  
  <p>... I don't enter TestFunc in debugger and the generated HTML of the href contains the embedded code simply as text: <code>href="%3C%=%20TestFunc%28%29%20%%3E"</code> </p>
  
  <p>What am I doing wrong here? I have already tried stupid trial and error: Replaced <code>=</code> by <code>#</code>, omitted <code>=</code> and replaced single quotation marks <code>'</code> by double quotation marks <code>"</code>. But all this didn't help. Now I am stumped.</p>
  
  <p>Thanks for help in advance!</p>