本文整理汇总了C#中RouteCollection.MapAreaRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapAreaRoute方法的具体用法?C# RouteCollection.MapAreaRoute怎么用?C# RouteCollection.MapAreaRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.MapAreaRoute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
string adminDomin = YFKConfig.Instance.WebSetting.AdminDomin;// "admin.yimo.dev";
string webDomin = YFKConfig.Instance.WebSetting.MainDomin;// "www.yimo.dev";
//上面的域名需要在IIS中绑定
routes.MapAreaRoute(
"YFK.Admin",
routes.MapRouteDomain(
name: "domin/Admin/Home/Index",
domain: adminDomin,
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "YFK.Admin.Controllers" }
)
);
routes.MapRouteDomain(
name: "Web/Home/Index",
domain: webDomin,
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new string[] { "YFK.Web.Controllers" }
);
}
示例2: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapAreaRoute(
"Store",
"Store_Default",
"Store/{controller}/{action}/{id}",
new { controller = "Products", action = "List", id = "" },
new string[] { "Store.Controllers" }
);
}
示例3: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// NOTE: Area Route Registration
Account.Routes.RegisterRoutes(routes);
Store.Routes.RegisterRoutes(routes);
routes.MapAreaRoute(
"Main", // Route name
"Main_Default",
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" }, // Parameter defaults
new string[] { "MyAreaApplication.Controllers" }
);
}