title: How to use Server Side variables on Markup
body: <p>I want to use Session variable's value on the markup. This is the code written on UserContorl.ascx, file on NavigateUrl I want to send the Username which is stored in the session variable. I don't want to set NavigateUrl value on PageLoad function for some reason.</p>
  
  <blockquote>
    <p>Note the code gives the error: The server tag is not well formed.</p>
  </blockquote>
  
  <pre><code>&lt;asp:Panel ID="pnlMenuItems" runat="server" HorizontalAlign="Left"&gt;
          &lt;asp:HyperLink ID="LinkLogout" runat="server" NavigateUrl="~/logout/"+
              &lt;%= HttpContext.Current.Session["UserName"].ToString(); %&gt;&gt; CssClass="pnlMenuItems"
              ForeColor="#666666"&gt;Logout&lt;/asp:HyperLink&gt;
  &lt;/asp:Panel&gt;
  </code></pre>