title: ASP.net WebForms - Using GetRouteUrl in markup
body: <p>I have been trying to figure out how to use the Routing features with ASP.net 4.0 WebForms.
  I added  a route to my route collection:</p>
  
  <pre><code>void Application_Start()
  {
      RegisterRoutes(RouteTable.Routes);
  }
  
  void RegisterRoutes(RouteCollection routes)
  {
      routes.MapPageRoute(
          "about-route",
          "about/",
          "~/About.aspx"
      );
  }
  </code></pre>
  
  <p>In my master page I tried to do the following:</p>
  
  <pre><code>&lt;asp:HyperLink ID="asdf" runat="server" NavigateUrl='&lt;%= GetRouteUrl("about-route", new {}) %&gt;'&gt;Test&lt;/asdf&gt;
  </code></pre>
  
  <p>I got a compiler error: Server tags cannot contain &lt;% ... %> constructs.</p>
  
  <p>What is the proper way to create a route URL in a server control in Web Forms? I also need to include it in the following:</p>
  
  <pre><code>&lt;asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"&gt;
      &lt;Items&gt;
          &lt;asp:MenuItem NavigateUrl="ROUTE HERE" Text="Home"/&gt;
          &lt;asp:MenuItem NavigateUrl="ROUTE HERE" Text="About"/&gt;
      &lt;/Items&gt;
  &lt;/asp:Menu&gt;
  </code></pre>