public void RegisterRoutes(RouteCollection routes) { //generic URLs routes.MapGenericPathRoute("GenericUrl", "{generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "Nop.Web.Controllers" }); routes.MapGenericPathRoute("GenericUrlKeyword", "{generic_se_name}/{city}", 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 = "Product", action = "ProductDetails" }, 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("Vendor", "{SeName}", new { controller = "Catalog", action = "Vendor" }, 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" }); routes.MapLocalizedRoute("Topic", "{SeName}", new { controller = "Topic", action = "TopicDetails" }, new[] { "Nop.Web.Controllers" }); //the last route. it's used when none of registered routes could be used for the current request //but in this case we cannot process non-registered routes (/controller/action) //routes.MapLocalizedRoute( // "PageNotFound-Wildchar", // "{*url}", // new { controller = "Common", action = "PageNotFound" }, // new[] { "Nop.Web.Controllers" }); }
public void RegisterRoutes(RouteCollection routes) { //generic URLs routes.MapGenericPathRoute("GenericUrl", "{*generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "SmartStore.Web.Controllers" }); // Routes solely needed for URL creation, NOT for route matching. routes.MapLocalizedRoute("Product", "{SeName}", new { controller = "Product", action = "Product" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Category", "{SeName}", new { controller = "Catalog", action = "Category" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Manufacturer", "{SeName}", new { controller = "Catalog", action = "Manufacturer" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("NewsItem", "{SeName}", new { controller = "News", action = "NewsItem" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BlogPost", "{SeName}", new { controller = "Blog", action = "BlogPost" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("PageNotFound", "{*path}", new { controller = "Error", action = "NotFound" }, new[] { "SmartStore.Web.Controllers" }); }
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" }); }
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" }); }
public void RegisterRoutes(RouteCollection routes) { //generic URLs routes.MapGenericPathRoute("GenericUrl", "{*generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "CAF.WebSite.Mvc.Controllers" }); // Routes solely needed for URL creation, NOT for route matching. routes.MapLocalizedRoute("Article", "{SeName}", new { controller = "Article", action = "Article" }, new[] { "CAF.WebSite.Mvc.Controllers" }); routes.MapLocalizedRoute("ArticleCategory", "{SeName}", new { controller = "ArticleCatalog", action = "Category" }, new[] { "CAF.WebSite.Mvc.Controllers" }); //routes.MapLocalizedRoute("Topic", // "{SeName}", // new { controller = "Topic", action = "Topic" }, // new[] { "CAF.WebSite.Mvc.Controllers" }); // TODO: actually this one's never reached, because the "GenericUrl" route // at the top handles this. routes.MapLocalizedRoute("PageNotFound", "{*path}", new { controller = "Error", action = "NotFound" }, new[] { "CAF.WebSite.Mvc.Controllers" }); }
public void RegisterRoutes(RouteCollection routes) { //Public Override routes.MapGenericPathRoute("Plugin.Misc.Custom.GenericUrl", "{generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { NAMESPACES }); }
public void RegisterRoutes(RouteCollection routes) { //generic URLs routes.MapGenericPathRoute("GenericUrl", "{generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "Nop.Web.Controllers" }); }
public void RegisterRoutes(RouteCollection routes) { //generic URLs routes.MapGenericPathRoute("GenericUrl", "{generic_se_name}", new {controller = "Common", action = "GenericUrl"}, new[] {"Nop.Web.Controllers"}); // MapLocalizedRoute define this routes to use in UI views (in case if you want to customize some of them later) routes.MapGenericPathRoute("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" }); //the last route. it's used when none of registered routes could be used for the current request //but it this case we cannot process non-registered routes (/controller/action) //routes.MapLocalizedRoute( // "PageNotFound-Wildchar", // "{*url}", // new { controller = "Common", action = "PageNotFound" }, // new[] { "Nop.Web.Controllers" }); }
public void RegisterRoutes(RouteCollection routes) { routes.MapGenericPathRoute("GenericUrl", "{name}", new { controller = "Common", action = "GenericUrl" }, new[] { "SMS.Controllers" }); routes.MapFriendlyRoute("School", "{name}", new { controller = "School", action = "Details" }, new[] { "SMS.Controllers" }).DataTokens.Remove("admin"); routes.MapFriendlyRoute("Teacher", "{name}", new { controller = "Teacher", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("Student", "{name}", new { controller = "Student", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("Product", "{name}", new { controller = "Product", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("News", "{name}", new { controller = "News", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("Event", "{name}", new { controller = "Event", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("Blog", "{name}", new { controller = "Blog", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("Page", "{name}", new { controller = "Page", action = "PageDetails" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("CustomPage", "{name}", new { controller = "Page", action = "PageDetails" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); routes.MapFriendlyRoute("ProductCategory", "{name}", new { controller = "ProductCategory", action = "Details" }, new string[] { "SMS.Controllers" }).DataTokens.Remove("area"); }
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" }); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("favicon.ico"); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapGenericPathRoute( name: "Menu", url: "{SeName}", defaults: new { controller = "Menu", action = "Index" }, namespaces: new[] { "Haxgo.Web.Controllers" } ); routes.MapGenericPathRoute( name: "Category", url: "{SeName}/{CategoryName}", defaults: new { controller = "Category", action = "Index" }, namespaces: new[] { "Haxgo.Web.Controllers" } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new[] { "Haxgo.Web.Controllers" } ); }
public void RegisterRoutes(RouteCollection routes) { // Generic URLs routes.MapGenericPathRoute("GenericUrl", "{*generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "SmartStore.Web.Controllers" }); // Routes solely needed for URL creation, NOT for route matching. routes.MapLocalizedRoute("Product", "{SeName}", new { controller = "Product", action = "Product" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Category", "{SeName}", new { controller = "Catalog", action = "Category" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Manufacturer", "{SeName}", new { controller = "Catalog", action = "Manufacturer" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Topic", "{SeName}", new { controller = "Topic", action = "TopicDetails" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("NewsItem", "{SeName}", new { controller = "News", action = "NewsItem" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BlogPost", "{SeName}", new { controller = "Blog", action = "BlogPost" }, new[] { "SmartStore.Web.Controllers" }); // TODO: actually this one's never reached, because the "GenericUrl" route // at the top handles this. routes.MapLocalizedRoute("PageNotFound", "{*path}", new { controller = "Error", action = "NotFound" }, new[] { "SmartStore.Web.Controllers" }); }
public void RegisterRoutes(RouteCollection routes) { //generic URLs routes.MapGenericPathRoute("GenericUrl", "{*generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "SmartStore.Web.Controllers" }); // Routes solely needed for URL creation, NOT for route matching. routes.MapLocalizedRoute("Product", "{SeName}", new { controller = "Product", action = "Product" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Category", "{SeName}", new { controller = "Catalog", action = "Category" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("Manufacturer", "{SeName}", new { controller = "Catalog", action = "Manufacturer" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("NewsItem", "{SeName}", new { controller = "News", action = "NewsItem" }, new[] { "SmartStore.Web.Controllers" }); routes.MapLocalizedRoute("BlogPost", "{SeName}", new { controller = "Blog", action = "BlogPost" }, new[] { "SmartStore.Web.Controllers" }); // TODO: actually this one's never reached, because the "GenericUrl" route // at the top handles this. routes.MapLocalizedRoute("PageNotFound", "{*path}", new { controller = "Error", action = "NotFound" }, new[] { "SmartStore.Web.Controllers" }); }
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" }); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("favicon.ico"); routes.IgnoreRoute("robots.txt"); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "About", url: "About", defaults: new { controller = "Page", action = "About" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "Contact", url: "Contact", defaults: new { controller = "Page", action = "Contact" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "Jobs", url: "Jobs", defaults: new { controller = "Page", action = "Jobs" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "Team", url: "Team", defaults: new { controller = "Page", action = "Team" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "Project", url: "Projects", defaults: new { controller = "Page", action = "Project" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "Search", url: "Search/{term}", defaults: new { controller = "Page", action = "Search" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "User", url: "User/{username}", defaults: new { controller = "User", action = "Index" }, namespaces: new[] { "Vertex.Web.Controllers" }); /* Generic Route for Categories & Posts */ routes.MapGenericPathRoute( name: "Slug", url: "{SeName}", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Vertex.Web.Controllers" }); /* Generic Route for Categories & Posts */ routes.MapGenericPathRoute( name: "PortfolioItem", url: "portfolio-item/{PortfolioItem}", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapGenericPathRoute( name: "JobDetail", url: "job-detail/{JobDetail}", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapGenericPathRoute( name: "PortfolioCategory", url: "portfolio-category/{PortfolioCategory}", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Vertex.Web.Controllers" }); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new[] { "Vertex.Web.Controllers" }); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); routes.IgnoreRoute("{*robotstxt}", new { robotstxt = @"(.*/)?robots.txt(/.*)?" }); routes.MapRoute("ImagesThumbnail", "Image", new { controller = "Images", action = "GetImage" }); routes.MapRoute("Captcha", "Image", new { controller = "Captcha", action = "Get" }); //generic URLs routes.MapGenericPathRoute("GenericUrl", "{generic_se_name}", new { controller = "Error", action = "Error404" }, new[] { "Uco.Controllers" }); //main site page routes.MapRoute( name: "HomePage", url: "", defaults: new { controller = "Page", action = "DomainPage", name = "root" }, namespaces: new string[] { "Uco.Controllers" } ); //Uco.dll pages foreach (Type item in RP.GetPageTypesReprository()) { routes.MapRoute( name: item.Name, url: SF.GetTypeRouteUrl(item) + "/{name}", defaults: new { controller = "Page", action = item.Name }, namespaces: new string[] { "Uco.Controllers" } ); routes.MapRoute( name: item.Name + "_Lang", url: "{lang}/" + SF.GetTypeRouteUrl(item) + "/{name}", defaults: new { controller = "Page", action = item.Name }, namespaces: new string[] { "Uco.Controllers" } ); } //if (SF.UsePlugins()) //{ //plugin dll pages //foreach (Type item in RP.GetPlugingsAbstractPageChildClasses()) //{ // string PageTypeName = item.Name; // string PluginNamespace = item.Namespace.Replace(".Models", ""); // routes.MapRoute( // name: PageTypeName, // url: SF.GetTypeRouteUrl(item) + "/{name}", // defaults: new { controller = "Page", action = PageTypeName }, // namespaces: new string[] { PluginNamespace + ".Controllers" } // ); // routes.MapRoute( // name: PageTypeName + "_Lang", // url: "{lang}/" + SF.GetTypeRouteUrl(item) + "/{name}", // defaults: new { controller = "Page", action = PageTypeName }, // namespaces: new string[] { PluginNamespace + ".Controllers" } // ); //} ////plugin dll data //foreach (string item in RP.GetPluginsReprository()) //{ // string Namespace = item + ".Controllers"; // routes.MapRoute( // name: Namespace, // url: item + "/{controller}/{action}/{id}", // defaults: new { id = UrlParameter.Optional }, // namespaces: new string[] { Namespace } // ); // routes.MapRoute( // name: "lang_" + Namespace, // url: "{lang}/" + item + "/{controller}/{action}/{id}", // defaults: new { id = UrlParameter.Optional }, // namespaces: new string[] { Namespace } // ); //} //} //Uco.dll data routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { id = UrlParameter.Optional }, namespaces: new string[] { "Uco.Controllers" } ); routes.MapRoute( name: "Default_Lang", url: "{lang}/{controller}/{action}/{id}", defaults: new { id = UrlParameter.Optional }, namespaces: new string[] { "Uco.Controllers" } ); }
public void RegisterRoutes(RouteCollection routes) { // Main generic path route routes.MapGenericPathRoute("GenericUrl", "{*generic_se_name}", new { controller = "Common", action = "GenericUrl" }, new[] { "SmartStore.Web.Controllers" }); GenericPathRoute.RegisterPaths( new GenericPath { EntityName = "Product", IdParamName = "productid", Order = int.MinValue, Route = routes.CreateLocalizedRoute(UrlTemplateFor("Product"), new { controller = "Product", action = "ProductDetails" }, new[] { "SmartStore.Web.Controllers" }) }, new GenericPath { EntityName = "Category", IdParamName = "categoryid", Order = int.MinValue + 1, Route = routes.CreateLocalizedRoute(UrlTemplateFor("Category"), new { controller = "Catalog", action = "Category" }, new[] { "SmartStore.Web.Controllers" }) }, new GenericPath { EntityName = "Manufacturer", IdParamName = "manufacturerid", Order = int.MinValue + 2, Route = routes.CreateLocalizedRoute(UrlTemplateFor("Manufacturer"), new { controller = "Catalog", action = "Manufacturer" }, new[] { "SmartStore.Web.Controllers" }) }, new GenericPath { EntityName = "Topic", IdParamName = "topicId", Order = int.MinValue + 3, Route = routes.CreateLocalizedRoute(UrlTemplateFor("Topic"), new { controller = "Topic", action = "TopicDetails" }, new[] { "SmartStore.Web.Controllers" }) }, new GenericPath { EntityName = "NewsItem", IdParamName = "newsItemId", Order = int.MinValue + 4, Route = routes.CreateLocalizedRoute(UrlTemplateFor("NewsItem"), new { controller = "News", action = "NewsItem" }, new[] { "SmartStore.Web.Controllers" }) }, new GenericPath { EntityName = "BlogPost", IdParamName = "blogPostId", Order = int.MinValue + 5, Route = routes.CreateLocalizedRoute(UrlTemplateFor("BlogPost"), new { controller = "Blog", action = "BlogPost" }, new[] { "SmartStore.Web.Controllers" }) } ); string UrlTemplateFor(string entityName) { var url = "{SeName}"; var prefix = GenericPathRoute.GetUrlPrefixFor(entityName); if (prefix.HasValue()) { return(prefix + "/" + "{SeName}"); } return(url); } }
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("Category", "{SeName}", new { controller = "Catalogue", action = "Category" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("MiniCategory", "{SeName}", new { controller = "Catalogue", action = "Category", area = "MiniSite" }, new { isLocal = new InnerHostConstraint() }, new[] { "Nop.Web.Areas.MiniSite.Controllers" }); routes.MapRoute("AddRequest", "Catalogue/AddRequest", new { controller = "Catalogue", action = "AddRequest" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("CategorySellers", "Sellers/{itemtype}/{SeName}", new { controller = "Catalogue", action = "SellerCatalogue", SeName = "all" }, new { itemtype = @"\S+", SeName = @"\S+", isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("SellerNews", "News/{SeName}", new { controller = "News", action = "SellerNews" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("Product", "{SeName}", new { controller = "Catalogue", action = "Details" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("MiniProduct", "{SeName}", new { controller = "Catalogue", action = "Details", area = "MiniSite" }, new { isLocal = new InnerHostConstraint() }, new[] { "Nop.Web.Areas.MiniSite.Controllers" }); //routes.MapLocalizedRoute("Manufacturer", // "{SeName}", // new { controller = "Catalog", action = "Manufacturer" }, // new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("NewsItem", "{SeName}", new { controller = "News", action = "NewsItem" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("MiniNewsItem", "{SeName}", new { controller = "News", action = "NewsItem", area = "MiniSite" }, new { isLocal = new InnerHostConstraint() }, new[] { "Nop.Web.Areas.MiniSite.Controllers" }); routes.MapLocalizedRoute("BlogPost", "{SeName}", new { controller = "Blog", action = "BlogPost" }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("Event", "{SeName}", new { controller = "Event", action = "EventInfo", pagenum = "{pagenum}" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); routes.MapLocalizedRoute("CompanyInformation", "{SeName}", new { controller = "Company", action = "CompanyInfo" }, new { isLocal = new LocalhostConstraint() }, new[] { "Nop.Web.Controllers" }); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("favicon.ico"); routes.IgnoreRoute("robots.txt"); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Sitemap", url: "sitemap.xml", defaults: new { controller = "Home", action = "Sitemap" }, namespaces: new[] { "Sefacan.Web.Controllers" }); routes.MapRoute( name: "About", url: "About-Me", defaults: new { controller = "Page", action = "About" }, namespaces: new[] { "Sefacan.Web.Controllers" }); routes.MapRoute( name: "Contact", url: "Contact", defaults: new { controller = "Page", action = "Contact" }, namespaces: new[] { "Sefacan.Web.Controllers" }); routes.MapRoute( name: "Project", url: "Projects", defaults: new { controller = "Page", action = "Project" }, namespaces: new[] { "Sefacan.Web.Controllers" }); //routes.MapRoute( // name: "Tag", // url: "Tag/{tag}", // defaults: new { controller = "Page", action = "Tag" }, // namespaces: new[] { "Sefacan.Web.Controllers" }); routes.MapRoute( name: "Search", url: "Search/{term}", defaults: new { controller = "Page", action = "Search" }, namespaces: new[] { "Sefacan.Web.Controllers" }); /* Old Category Url */ routes.MapGenericPathRoute( name: "OldCategory", url: "kategori/{id}/{categoryName}.html", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Sefacan.Web.Controllers" }); /* Old Category Url */ /* Old Post Url */ routes.MapGenericPathRoute( name: "OldPost", url: "post/{id}/{title}.html", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Sefacan.Web.Controllers" }); /* Old Post Url */ /* Generic Route for Categories & Posts */ routes.MapGenericPathRoute( name: "UniqueUrl", url: "{SeName}", defaults: new { controller = "Home", action = "NotFound" }, namespaces: new[] { "Sefacan.Web.Controllers" }); /* Generic Route for Categories & Posts */ routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new[] { "Sefacan.Web.Controllers" }); }