我有这条路线:
我在WebSite / Global.asax.cs上的网站路线:
namespace WebSite { public class MvcApplication : HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); ... routes.MapRoute( "Default","Authenticated/{controller}/{action}/{id}",new { controller = "Home",action = "Index",id = UrlParameter.Optional },new[] { "WebSite.Controllers" } ); ... } void Application_Start() { ... AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); ... } } }@H_301_5@我在WebSite / Areas / Admin / AdminAreaRegistration.cs上的管理区路由:
namespace WebSite.Areas.Admin { public class AdminAreaRegistration : AreaRegistration { public override string AreaName { get { return "Admin"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Admin_default","qwerty/Admin/{controller}/{action}/{id}",new { action = "Index",new[] { "WebSite.Areas.Admin.Controllers" } ); } } }@H_301_5@我的网址:
WebSite: http://www.mywebsite.com/Authenticated/Controller/Action... Admin: http://www.mywebsite.com/qwerty/Admin/Controller/Action...@H_301_5@我的问题:
使用WebSite URL,我可以从管理区域调用控制器/操作,而不使用“qwerty / Admin”,这是不对的.我怎样才能解决这个问题?
谢谢.