Sunday 4 September 2011

How Does MVC Know Which Controller to Invoke?

As well as models, views, and controllers, ASP.NET MVC applications also use the routing system. This piece of infrastructure decides how URLs map onto particular controllers and actions. Under the default routing configuration, you could request any of the following URLs and it would be handled by the Index action on HomeController:
  • /
  • /Home
  • /Home/Index
Add a note hereSo, when a browser requests http://yoursite/ or http://yoursite/Home, it gets back the output from HomeController's Index method.

No comments:

Post a Comment