title: Routing to an anchor on another page
body: <p>I am using Web Forms Routing in ASP.NET 4 and I am trying to route to a specific location on a page. On that page I have an element like <code>&lt;div id="3"&gt;</code> and I'd like to jump to this anchor from another page. For this purpose I have defined a Route in <code>global.asax</code>:</p>
  
  <pre><code>RouteTable.Routes.MapPageRoute("MyRoute", "Path/SubPath/{PageAnchor}",
      "~/MyPage.aspx", true, new RouteValueDictionary { { "PageAnchor", null } });
  </code></pre>
  
  <p>The HyperLink to link to that page and the anchor "3" is defined this way in markup:</p>
  
  <pre><code>&lt;asp:HyperLink ID="HyperLink1" runat="server"
      NavigateUrl="&lt;%$ RouteUrl:RouteName=MyRoute,PageAnchor=#3 %&gt;"&gt;
      Link&lt;/asp:HyperLink&gt;
  </code></pre>
  
  <p>The problem with the generated link is that the <code>#</code> character in the URL gets encoded by <code>%23</code> this way: <code>http://localhost:1234/Path/SubPath/%233</code> so that I reach the target page but not at the specified anchor.</p>
  
  <p>Is there a way to avoid this unwished URL-encoding? Or any other way to route to an anchor?</p>
  
  <p>Thank you in advance!</p>