title: ASP.NET MVC 2 How are urls/routes, views related to controllers?
body: <p>Could someone explain how routes are associated with controllers in MVC 2? Currently, I have a controller in /Controllers/HomeController.cs and a view /Home/Index.aspx.</p>
  
  <p>My route registration method looks like this:</p>
  
  <pre><code> public static void RegisterRoutes(RouteCollection routes)
          {
              routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
              routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
              routes.MapRoute(
                 "Default",
                  // Route name
                 "{controller}/{action}/{id}",
                  // URL with parameters
                 new { controller = "Home", action = "Index", id = "" }
                  // Parameter defaults
                );
          }
  </code></pre>
  
  <p>If I request the URL: <a href="http://localhost/Home/Index" rel="nofollow noreferrer">http://localhost/Home/Index</a>, then the request is correctly handled by HomeController.Index().</p>
  
  <p>However, for the life of me, I can't figure out how the url /Home/Index gets pointed to HomeController. The view aspx doesn't, as far as I can tell, reference HomeController, HomeController doesn't reference the view, and the route table doesn't explicitly mention HomeController. How is this magically happening? Surely I'm missing something obvious.</p>
  
  <p>then </p>