本文整理汇总了C#中RouteCollection.MapLocalizedRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapLocalizedRoute方法的具体用法?C# RouteCollection.MapLocalizedRoute怎么用?C# RouteCollection.MapLocalizedRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.MapLocalizedRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.html/{*pathInfo}");
// Notice:
// Put all custom MapRoute above default.
routes.MapLocalizedRoute("HomePage", // Route name
"", // URL with parameters
new { controller = "Home", action = "Index"}, // Parameter defaults
new[] { "Aaron.Web.Controllers" }
);
//topic
routes.MapLocalizedRoute("Topic",
"{SystemName}",
new { controller = "Topic", action = "TopicDetails" },
new[] { "Aaron.Web.Controllers" });
routes.MapLocalizedRoute("TopicAuthenticate",
"topic/authenticate",
new { controller = "Topic", action = "Authenticate" },
new[] { "Aaron.Web.Controllers" });
//robots.txt
routes.MapLocalizedRoute("robots.txt",
"r/robots.txt",
new { controller = "Common", action = "RobotsTextFile" },
new[] { "Aaron.Web.Controllers" });
}
示例2: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
try
{
routes.Add("WorkflowRoute", new System.Web.Routing.Route("Workflow/{page}.aspx/{*path}", routeHandler: new PluginRouteHandler()));
routes.MapLocalizedRoute("Workflow.eForm.Index",
"Workflow/eForm",
new { controller = "eForm", action = "Index", },
new[] { "AgileEAP.Plugin.Workflow.Controllers" });
routes.MapLocalizedRoute("Workflow.Process.Tracking",
"Workflow/Process/Tracking",
new { controller = "Design", action = "DrawWorkflow", },
new[] { "AgileEAP.Plugin.Workflow.Controllers" });
routes.MapRoute("Workflow.Default.Route",
"Workflow/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "AgileEAP.Plugin.Workflow.Controllers" });
}
catch (Exception ex)
{
GlobalLogger.Error<RouteProvider>("初始化插件Workflow路由出错{0}", ex);
}
}
示例3: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
//generic URLs
routes.MapGenericPathRoute("GenericUrl",
"{generic_se_name}",
new {controller = "Common", action = "GenericUrl"},
new[] {"Nop.Web.Controllers"});
//define this routes to use in UI views (in case if you want to customize some of them later)
routes.MapLocalizedRoute("Product",
"{SeName}",
new {controller = "Catalog", action = "Product"},
new[] {"Nop.Web.Controllers"});
routes.MapLocalizedRoute("Category",
"{SeName}",
new { controller = "Catalog", action = "Category" },
new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("Manufacturer",
"{SeName}",
new { controller = "Catalog", action = "Manufacturer" },
new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("NewsItem",
"{SeName}",
new { controller = "News", action = "NewsItem" },
new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("BlogPost",
"{SeName}",
new { controller = "Blog", action = "BlogPost" },
new[] { "Nop.Web.Controllers" });
}
示例4: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
//products
routes.MapLocalizedRoute("", "p/{productId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectProductById", SeName = UrlParameter.Optional },
new { productId = @"\d+" },
new[] { "Nas.Web.Controllers" });
//categories
routes.MapLocalizedRoute("", "c/{categoryId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectCategoryById", SeName = UrlParameter.Optional },
new { categoryId = @"\d+" },
new[] { "Nas.Web.Controllers" });
//manufacturers
routes.MapLocalizedRoute("", "m/{manufacturerId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectManufacturerById", SeName = UrlParameter.Optional },
new { manufacturerId = @"\d+" },
new[] { "Nas.Web.Controllers" });
//news
routes.MapLocalizedRoute("", "news/{newsItemId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectNewsItemById", SeName = UrlParameter.Optional },
new { newsItemId = @"\d+" },
new[] { "Nas.Web.Controllers" });
//blog
routes.MapLocalizedRoute("", "blog/{blogPostId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectBlogPostById", SeName = UrlParameter.Optional },
new { blogPostId = @"\d+" },
new[] { "Nas.Web.Controllers" });
}
示例5: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
//home page
routes.MapLocalizedRoute("Home_Index",
"",
new { controller = "Home", action = "Index" },
new[] { "AgileEAP.Web.Controllers" });
routes.MapRoute(
"DenyAccess", // Route name
"DenyAccess/", // URL with parameters
new { controller = "Authorize", action = "DenyAccess" },
new[] { "AgileEAP.Web.Controllers" }
);
//login, register
routes.MapLocalizedRoute("Login",
"login",
new { controller = "Authorize", action = "Login" },
new[] { "AgileEAP.Web.Controllers" });
routes.MapLocalizedRoute("Logout",
"logout/",
new { controller = "Authorize", action = "Logout" },
new[] { "AgileEAP.Web.Controllers" });
routes.MapLocalizedRoute("Navigate",
"Navigate/",
new { controller = "Home", action = "Navigate" },
new[] { "AgileEAP.Web.Controllers" });
//routes.MapLocalizedRoute("Register",
// "register/",
// new { controller = "Authorize", action = "Register" },
// new[] { "AgileEAP.Web.Controllers" });
//routes.MapLocalizedRoute("RegisterResult",
// "registerresult/{resultId}",
// new { controller = "Authorize", action = "RegisterResult" },
// new { resultId = @"\d+" },
// new[] { "AgileEAP.Web.Controllers" });
////contact us
//routes.MapLocalizedRoute("ContactUs",
// "contactus",
// new { controller = "Common", action = "ContactUs" },
// new[] { "AgileEAP.Web.Controllers" });
////passwordrecovery
//routes.MapLocalizedRoute("PasswordRecovery",
// "passwordrecovery",
// new { controller = "Customer", action = "PasswordRecovery" },
// new[] { "AgileEAP.Web.Controllers" });
//routes.MapLocalizedRoute("PasswordRecoveryConfirm",
// "passwordrecovery/confirm",
// new { controller = "Customer", action = "PasswordRecoveryConfirm" },
// new[] { "AgileEAP.Web.Controllers" });
}
示例6: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
var route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Vendor.GroupDealsController",
"Vendor/GroupDeals/{action}/{id}",
new { area = "Vendor", controller = "GroupDeals", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Vendor.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Admin.GroupDealsController",
"Admin/GroupDeals/{action}/{id}",
new { area = "Admin", controller = "GroupDeals", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Admin.Controllers" }
);//.DataTokens.Add("area", "Admin")
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Public.GroupDealsController",
"GroupDeals/{action}/{id}",
new { controller = "GroupDeals", action = "Index", id = UrlParameter.Optional },
new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Public.GdShoppingCartController",
"GdShoppingCart/{action}",
new { controller = "GdShoppingCart", action = "Cart" },
new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" }
);
routes.Remove(route);
routes.Insert(0, route);
//add groupdeal to cart (without any attributes and options). used on catalog pages.
route = routes.MapLocalizedRoute("AddGroupDealToCart-Catalog",
"addgroupdealtocart/catalog/{groupDealId}/{shoppingCartTypeId}/{quantity}",
new { controller = "GdShoppingCart", action = "AddGroupDealToCart_Catalog" },
new { groupDealId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+" },
new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" });
routes.Remove(route);
routes.Insert(0, route);
//add groupdeal to cart (with attributes and options). used on the groupdeal details pages.
route = routes.MapLocalizedRoute("AddGroupDealToCart-Details",
"addgroupdealtocart/details/{groupDealId}/{shoppingCartTypeId}",
new { controller = "GdShoppingCart", action = "AddGroupDealToCart_Details" },
new { groupDealId = @"\d+", shoppingCartTypeId = @"\d+" },
new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" });
routes.Remove(route);
routes.Insert(0, route);
ViewEngines.Engines.Insert(0, new CustomViewEngine());
}
示例7: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
routes.MapLocalizedRoute("MyTestUrl",
"que-huong/hahaha",
new { controller = "Canada", action = "Index" },
new[] { "Research.Plugin.Shipping.CanadaPost.Controllers" }
);
}
示例8: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
//We reordered our routes so the most used ones are on top. It can improve performance.
//home page
routes.MapLocalizedRoute("HomePage",
"",
new { controller = "Home", action = "Index" },
new[] { "Nut.Web.Controllers" });
//login
routes.MapLocalizedRoute("Login",
"login/",
new { controller = "User", action = "Login" },
new[] { "Nut.Web.Controllers" });
//register
routes.MapLocalizedRoute("Register",
"register/",
new { controller = "User", action = "Register" },
new[] { "Nut.Web.Controllers" });
//logout
routes.MapLocalizedRoute("Logout",
"logout/",
new { controller = "User", action = "Logout" },
new[] { "Nut.Web.Controllers" });
//install
routes.MapRoute("Installation",
"install",
new { controller = "Install", action = "Index" },
new[] { "Nut.Web.Controllers" });
//License
routes.MapRoute("License",
"License",
new { controller = "License", action = "Index" },
new[] { "Nut.Web.Controllers" });
//page not found
routes.MapLocalizedRoute("PageNotFound",
"page-not-found",
new { controller = "Common", action = "PageNotFound" },
new[] { "Nut.Web.Controllers" });
}
示例9: ConfigureRoutes
public void ConfigureRoutes(RouteCollection routes)
{
var culture = StrixPlatform.DefaultCultureCode.ToLower();
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.LowercaseUrls = true;
routes.RouteExistingFiles = true;
var adminRoute = RouteTable.Routes.MapLocalizedRoute(
"Admin_default",
"{language}/Admin/{controller}/{action}/{id}",
new { language = culture, controller = WebConstants.ADMIN, action = MvcConstants.INDEX, id = UrlParameter.Optional },
new { controller = new AdminRouteConstraint() });
routes.RemoveAt(routes.Count - 1);
routes.Insert(0, adminRoute);
routes.MapLocalizedRoute(
"NotFound",
"{language}/NotFound/{url}",
new { language = culture, controller = "Home", action = "NotFound", url = UrlParameter.Optional });
routes.MapLocalizedRoute(
"Error",
"{language}/Error",
new { language = culture, controller = "Home", action = "Error" });
routes.MapLocalizedRoute(
name: "Search",
url: "{language}/Search/{action}/{options}",
defaults: new { language = culture, controller = "Search", action = "Index", options = UrlParameter.Optional });
routes.MapLocalizedRoute(
name: "Default",
url: "{language}/{controller}/{action}/{id}",
defaults: new { language = culture, controller = "Home", action = "Index", id = UrlParameter.Optional });
}
示例10: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
//generic URLs
routes.MapGenericPathRoute("GenericUrl",
"{*generic_se_name}",
new { controller = "Common", action = "GenericUrl" },
new[] { "Seo.Route.Controllers" });
// Routes solely needed for URL creation, NOT for route matching.
routes.MapLocalizedRoute("EngineerSeo1",
"{SeName}",
new { controller = "Engineers", action = "EngineerDetails" },
new[] { "Seo.Route.Controllers" });
routes.MapLocalizedRoute("EngineerSeo2",
"{SeCountry}",
new { controller = "Engineers", action = "EngineerDetails" },
new[] { "Seo.Route.Controllers" });
routes.MapLocalizedRoute("EngineerSeo3",
"{SeMobile}",
new { controller = "Engineers", action = "EngineerDetails" },
new[] { "Seo.Route.Controllers" });
}
示例11: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
var supportPreviousNopcommerceVersions =
!String.IsNullOrEmpty(ConfigurationManager.AppSettings["SupportPreviousNopcommerceVersions"]) &&
Convert.ToBoolean(ConfigurationManager.AppSettings["SupportPreviousNopcommerceVersions"]);
if (!supportPreviousNopcommerceVersions)
return;
//products
routes.MapLocalizedRoute("", "p/{productId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectProductById", SeName = UrlParameter.Optional },
new { productId = @"\d+" },
new[] { "TinyCms.Web.Controllers" });
//categories
routes.MapLocalizedRoute("", "c/{categoryId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectCategoryById", SeName = UrlParameter.Optional },
new { categoryId = @"\d+" },
new[] { "TinyCms.Web.Controllers" });
//manufacturers
routes.MapLocalizedRoute("", "m/{manufacturerId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectManufacturerById", SeName = UrlParameter.Optional },
new { manufacturerId = @"\d+" },
new[] { "TinyCms.Web.Controllers" });
//news
routes.MapLocalizedRoute("", "news/{newsItemId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectNewsItemById", SeName = UrlParameter.Optional },
new { newsItemId = @"\d+" },
new[] { "TinyCms.Web.Controllers" });
//blog
routes.MapLocalizedRoute("", "blog/{blogPostId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectBlogPostById", SeName = UrlParameter.Optional },
new { blogPostId = @"\d+" },
new[] { "TinyCms.Web.Controllers" });
//topic
routes.MapLocalizedRoute("", "t/{SystemName}",
new { controller = "BackwardCompatibility2X", action = "RedirectTopicBySystemName" },
new[] { "TinyCms.Web.Controllers" });
//vendors
routes.MapLocalizedRoute("", "vendor/{vendorId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectVendorById", SeName = UrlParameter.Optional },
new { vendorId = @"\d+" },
new[] { "TinyCms.Web.Controllers" });
}
示例12: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
// đăng ký mẫu url khái quát dùng để phân giải Url đến với loại có 1 phân đoạn và đa ngôn ngữ. Route này được đặt sau tất cả
// các route thông dụng, cho nên chỉ khi ko thể nào phân giải được ở các route trước đó, code mới chạy đến route này
// việc phân giải url ở view sẽ ko đi vào route này, vì route đòi hỏi 1 phân đoạn tên rất đặc biệt: "generic_se_name",
// sẽ ko có 1 yêu cầu nào ở view dùng tên phân đoạn "kỳ lạ" như thế này
routes.MapGenericPathRoute("GenericUrl",
"{generic_se_name}",
new { controller = "Common", action = "GenericUrl" },
new[] { "Research.Web.Controllers" });
// các route này chỉ dùng để tạo link trong các view chứ ko hề có ý nghĩa trong phân giải url đến. Tất cả các url đến
// loại 1 phân đoạn nếu có thể đều sẽ đi vào GenericPathRoute ở phía trên
routes.MapLocalizedRoute("Product",
"{SeName}",
new { controller = "Product", action = "ProductDetails" },
new[] { "Research.Web.Controllers" });
routes.MapLocalizedRoute("Category",
"{SeName}",
new { controller = "Catalog", action = "Category" },
new[] { "Research.Web.Controllers" });
routes.MapLocalizedRoute("Manufacturer",
"{SeName}",
new { controller = "Catalog", action = "Manufacturer" },
new[] { "Research.Web.Controllers" });
routes.MapLocalizedRoute("Vendor",
"{SeName}",
new { controller = "Catalog", action = "Vendor" },
new[] { "Research.Web.Controllers" });
routes.MapLocalizedRoute("NewsItem",
"{SeName}",
new { controller = "News", action = "NewsItem" },
new[] { "Research.Web.Controllers" });
routes.MapLocalizedRoute("BlogPost",
"{SeName}",
new { controller = "Blog", action = "BlogPost" },
new[] { "Research.Web.Controllers" });
routes.MapLocalizedRoute("Topic",
"{SeName}",
new { controller = "Topic", action = "TopicDetails" },
new[] { "Research.Web.Controllers" });
}
示例13: RegisterRoutes
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 }
//);
routes.MapLocalizedRoute(
defaultCulture: "en-US",
name: "Default_Culturized",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
示例14: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
routes.MapLocalizedRoute(
"Default_Localized",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new { controller = new IsKnownController() },
new[] { "SmartStore.Web.Controllers" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new { controller = new IsKnownController() },
new[] { "SmartStore.Web.Controllers" }
);
}
示例15: RegisterRoutes
public void RegisterRoutes(RouteCollection routes)
{
var config = EngineContext.Current.Resolve<NopConfig>();
if (!config.SupportPreviousNopcommerceVersions)
return;
//products
routes.MapLocalizedRoute("", "p/{productId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectProductById", SeName = UrlParameter.Optional },
new { productId = @"\d+" },
new[] { "Nop.Web.Controllers" });
//categories
routes.MapLocalizedRoute("", "c/{categoryId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectCategoryById", SeName = UrlParameter.Optional },
new { categoryId = @"\d+" },
new[] { "Nop.Web.Controllers" });
//manufacturers
routes.MapLocalizedRoute("", "m/{manufacturerId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectManufacturerById", SeName = UrlParameter.Optional },
new { manufacturerId = @"\d+" },
new[] { "Nop.Web.Controllers" });
//news
routes.MapLocalizedRoute("", "news/{newsItemId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectNewsItemById", SeName = UrlParameter.Optional },
new { newsItemId = @"\d+" },
new[] { "Nop.Web.Controllers" });
//blog
routes.MapLocalizedRoute("", "blog/{blogPostId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectBlogPostById", SeName = UrlParameter.Optional },
new { blogPostId = @"\d+" },
new[] { "Nop.Web.Controllers" });
//topic
routes.MapLocalizedRoute("", "t/{SystemName}",
new { controller = "BackwardCompatibility2X", action = "RedirectTopicBySystemName" },
new[] { "Nop.Web.Controllers" });
//vendors
routes.MapLocalizedRoute("", "vendor/{vendorId}/{SeName}",
new { controller = "BackwardCompatibility2X", action = "RedirectVendorById", SeName = UrlParameter.Optional },
new { vendorId = @"\d+" },
new[] { "Nop.Web.Controllers" });
}