title: How to change an ASP.net MVC URL
body: <p>Is there a simple way of generating a new Route-URL without all this faff.</p>
  
  <p>I'm currently Handling several routes to the same view, all of which end with 
  /{pagenumber}</p>
  
  <p>All I'm trying to do is delete everything back to the last backslash and replace the number.</p>
  
  <p>I was trying to avoid using the URL Maker as it seems a tad overkill for pagination but all suggestions welcome&hellip;</p>
  
  <p>Heres the method im using for pagination</p>
  
  <pre><code>#region Create View Pagination
  /// &lt;summary&gt;
  /// Create Pagination For Display
  /// &lt;/summary&gt;
  /// &lt;param name="TotalPgs"&gt;&lt;/param&gt;
  /// &lt;param name="currentPg"&gt;&lt;/param&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private string pagnationStr(int TotalPgs, int currentPg)
  {
      string tmp = "";
      string URLX = "";
  
      URLX = string.Format("{0}", base.Request.Url);
  
      int pageSet = 10;
  
      //Previous Link
      if (currentPg &gt; 1) tmp += "&lt;li&gt;&lt;a href='" + URLX + (currentPg - 1) + "'&gt;Previous&lt;/a&gt;&lt;/li&gt;";
  
      //Standard Pagination
      tmp += "&lt;ul class=\"pagination\"&gt;";
      for (int i = currentPg; i &lt; TotalPgs; i++)
      {
          tmp += "&lt;li&gt;&lt;a href='" + URLX + i + "'&gt;" + i.ToString() + "&lt;/a&gt;&lt;/li&gt;";
          if (pageSet &lt; 1) break;
          pageSet--;
      }
      tmp += "&lt;/ul&gt;";
  
      return tmp;
  }
  #endregion
  </code></pre>
  
  <ul>
  <li>various bits of this normally come from the app-settings I've replaced them with numbers to be complete.</li>
  </ul>