Class CatalogRouteHelper

Contains helper methods to register routes for commerce catalog items.

Inheritance
System.Object
CatalogRouteHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Routing
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
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 true the outgoing links for catalog items will use the SEO URL.

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 true the outgoing links for catalog items will use the SEO URL.

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()