Class CatalogRouteHelper
Contains helper methods to register routes for commerce catalog items.
Inheritance
Inherited Members
Namespace: EPiServer.Commerce.Routing
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0Syntax
public class CatalogRouteHelper
Examples
The recommended way is to do it in an EPiServer.Framework.IInitializableModule.
using System.Web.Routing;
using EPiServer.Framework;
using EPiServer.Commerce.Routing;
using EPiServer.Framework.Initialization;
namespace CodeSamples.EPiServer.Commerce.Catalog
{
[ModuleDependency(typeof(global::EPiServer.Commerce.Initialization.InitializationModule))]
public class RegisterRoutingModuleSample : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
MapRoutes(RouteTable.Routes);
}
private static void MapRoutes(RouteCollection routes)
{
CatalogRouteHelper.MapDefaultHierarchialRouter(routes, true);
}
public void Uninitialize(InitializationEngine context) { /*uninitialize*/}
public void Preload(string[] parameters) { }
}
}
Constructors
CatalogRouteHelper()
Declaration
public CatalogRouteHelper()
Methods
MapDefaultHierarchialRouter(RouteCollection, Boolean)
Registers a default partial router for catalog content.
Declaration
public static void MapDefaultHierarchialRouter(RouteCollection routes, bool enableOutgoingSeoUri)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Routing.RouteCollection | routes | The route collection. |
System.Boolean | enableOutgoingSeoUri | if set to |
MapDefaultHierarchialRouter(RouteCollection, Func<ContentReference>, Boolean)
Registers a default partial router for catalog content.
Declaration
public static void MapDefaultHierarchialRouter(RouteCollection routes, Func<ContentReference> startingPoint, bool enableOutgoingSeoUri)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Routing.RouteCollection | routes | The route collection. |
System.Func<EPiServer.Core.ContentReference> | startingPoint | The starting point where the partial route will start. |
System.Boolean | enableOutgoingSeoUri | if set to |
SetupSeoUriPermanentRedirect()
Registers an eventhandler to call RedirectToSeoUri(RoutingEventArgs) when a content has been routed, so that SeoRedirectHandler can make sure that any request for commerce content using the hierarchial URL when there is a SEO Url for that content will be permanently redirected to the SEO Url.
Declaration
public static void SetupSeoUriPermanentRedirect()