title: ASP.Net MVC routing issue url not working
body: <p>I created two action methods with a different name in the home controller</p>
  
  <pre><code>public ActionResult Default()
  {
      ViewData["Message"] = "Welcome to ASP.NET MVC!";
      return View("index");
  }
  
  public ActionResult Index(int a)
  {
      ViewData["Message"] = "Welcome to ASP.NET MVC! and Your Age is " + a;
      return View();
  }
  </code></pre>
  
  <p>And my routing code look like:</p>
  
  <pre><code>routes.MapRoute(
    "Default1", // Route name
    "{Home}/{ID}", // URL with parameters
    new { controller = "Home", action = "Index", id =UrlParameter.Optional});
  
  routes.MapRoute(
      "Default2", // Route name
      "{Home}", // URL with parameters
      new { controller = "Home", action = "Default" }
  );
  
  routes.MapRoute(
      "Default", // Route name
      "{controller}", // URL with parameters
      new { controller = "Home", action = "Default" }
  );
  </code></pre>
  
  <p>But still getting problem</p>
  
  <p>when I type URL like <strong><a href="http://localhost:7221" rel="nofollow noreferrer">http://localhost:7221</a></strong> then home is coming and Default() method invoking but if I type URL like</p>
  
  <p><strong><a href="http://localhost:7221/Home" rel="nofollow noreferrer">http://localhost:7221/Home</a></strong> then getting error. to handle this situation i define route like</p>
  
  <pre><code>routes.MapRoute(
      "Default2", // Route name
      "{Home}", // URL with parameters
      new { controller = "Home", action = "Default" }
  );
  </code></pre>
  
  <p>But it is not working.......can u tell me why.</p>
  
  <p>If I type URL like <strong><a href="http://localhost:7221/Home/88" rel="nofollow noreferrer">http://localhost:7221/Home/88</a></strong> then Index(int a) method should be called but getting error. why</p>
  
  <p>I want that when I type URL <strong><a href="http://localhost:7221" rel="nofollow noreferrer">http://localhost:7221</a></strong> or <strong><a href="http://localhost:7221/Home" rel="nofollow noreferrer">http://localhost:7221/Home</a></strong> then Default() should be called and when I will type</p>
  
  <p><strong><a href="http://localhost:7221/Home/88" rel="nofollow noreferrer">http://localhost:7221/Home/88</a></strong> then Index(int a) should be invoked. What is wrong in my route? How can I rectify it? if possible rectify my route code. thanks</p>