How to define a route in ASP.NET MVC?


You can define a route in ASP.NET MVC as given below:

public static void RegisterRoutes(RouteCollection routes) 
{ 
    routes.MapRoute( "Default", // Route name 
    "{controller}/{action}/{id}", // Route Pattern 
    new { 
            controller = "Home", action = "Index", id = UrlParameter.Optional 
        }// Default values for above defined parameters 
        ); 
} 
protected void Application_Start()
{ 
    RegisterRoutes(RouteTable.Routes); //TODO: 
}