February 2010
Beginner
400 pages
11h 13m
English
By now, you should have a basic understanding of URL routing in MVC and how important it is. Routing is very flexible, and the default can be modified by changing the rules in Global.asax. Right-click Global.asax (it handles global events within your application), and select View Code. Your code will look similar to the following:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
But what's this code doing? I will ...