If you create an application namespace, this is MvcApplication1, you wrote it.
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); AreaRegistration.RegisterAllAreas(); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" }, // Parameter defaults null, new[] { "MvcApplication1.Controllers" } ); }
Set the namespace of the root route controller "MvcApplication1.Controllers", it works.
Hope these are tips.
takepara
source share