title: ASP.NET 4.0 webforms routing within master page
body: <p>I just want to asked if there's a workaround in url routing using masterpage. I put the links in my masterpage (i.e. first link is a href="Bookstore/CSS" and the other link is a href="tools/toolx") if i click the first link it redirect me to the correct url which is localhost:2039/Bookstore/but if i click the next link it will redirect me to localhost:2039/tools/Bookstore/CSS but the link should be localhost:2039/Bookstore/CSS.</p>
  
  <p>Here is the code</p>
  
  <p>global.asax</p>
  
  <pre><code>void Application_Start(object sender, EventArgs e)
      {
          // Code that runs on application startup
          RouteTable.Routes.MapPageRoute("StoreRoute",
          "BookStore/{Name}",
          "~/Webpages/BookStore/ViewBookDemo.aspx");
  
          RouteTable.Routes.MapPageRoute("mytool",
          "tools/{Name}",
          "~/tools/tools.aspx");
      }
  </code></pre>
  
  <p>masterpage source code</p>
  
  <pre><code>&lt;div class="page"&gt;
      &lt;div &gt;
          &lt;div class="title"&gt;
              &lt;h1&gt;
                  URL Routing in MAsterpage
              &lt;/h1&gt;
          &lt;/div&gt;
          &lt;div class="clear hideSkiplink"&gt;
              &lt;asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"&gt;
                  &lt;Items&gt;
                      &lt;asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/&gt;
                  &lt;/Items&gt;
              &lt;/asp:Menu&gt;
          &lt;/div&gt;
      &lt;/div&gt;
     &lt;div class="clear"&gt; &lt;/div&gt;
     &lt;div style=" width:90%"&gt;
    &lt;div style="float:left; width:25%;border: 1px solid #009933;"&gt; 
    &lt;br /&gt;
      &lt;a href="Bookstore/CSS"&gt;Click Here to go to bookstore&lt;/a&gt;.
     &lt;div class="clear"&gt; &lt;/div&gt;
     &lt;p&gt;
        &lt;a href="tools/toolx"&gt;Click Here to go to tools&lt;/a&gt;.
    &lt;/p&gt; &lt;/div&gt;
     &lt;div style="float:right;width:73%"&gt;
     &lt;div class="main"&gt;
          &lt;asp:ContentPlaceHolder ID="MainContent" runat="server"/&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;/div&gt;
       &lt;div class="clear"&gt; &lt;/div&gt;
  &lt;div class="footer"&gt;
  
  &lt;/div&gt;
  </code></pre>