public class BookStudyAreaRegistration : AreaRegistration { public override string AreaName { get { return "BookStudy"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "BookStudy_default","BookStudy/{controller}/{action}/{id}"
, new { action = "Index", id = UrlParameter.Optional } ); } }
public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url:"{controller}/{action}/{id}"
, defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[] { "MyKB.Controllers" } ); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); // here FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
原文:http://www.cnblogs.com/pengzhen/p/3774504.html