title: MVC ignores route defaults and renders full “/Home/Index” URLs instead of root
body: <p>My ASP.NET MVC project seems to ignore route defaults when <em>composing</em> URLs. For instance, <code>Url.Action("Index", "Home")</code> returns <code>/Home/Index/</code>, while it should return just <code>/</code> (which I have seen in all my other MVC websites). It does not have any problem with <em>using</em> URLs, e.g. by visiting <code>http://myserver/</code>, the default controller and action are found correctly.</p>
  
  <p>How can I fix the behavior? (Note that I have found <a href="https://stackoverflow.com/questions/26301573/how-to-force-mvc-to-route-to-home-index-instead-of-root">questions</a> asking how to <em>achieve</em> this behavior, but nobody seems to suffer from this opposite problem.)</p>
  
  <p>The project is nothing spectacular, no custom routing handlers etc., and the routing configuration is quite simple:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public static void RegisterRoutes(RouteCollection routes)
  {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
      routes.IgnoreRoute("LoginHandler");
  
      routes.MapRoute(
          name: "Default",
          url: "{controller}/{action}/{*id}",
          defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
      );
  }
  </code></pre>
  
  <p>(The <code>*</code> is there because some actions use arbitrary strings as identifiers which might contain embedded slashes, and without the asterisk, the route does not match for such URLs.)</p>