SaaS CMS has officially launched! Learn more now.

CustomContentApiRoutingEventHandler namespace not found



In this example, there is a reference to CustomContentApiRoutingEventHandler and we have added these namespaces:

  • EPiServer.ContentApi.Cms
  • EPiServer.ContentApi.Core.Configuration 
  • EPiServer.ContentApi.Routing

and it is still missing... 

Anyone got a clue?

Sep 15, 2020 12:24

Hi Fredrik,

The CustomContentApiRoutingEventHandler is not part of the given namespaces or EPiServer.ContentDeliveryApi. You have to create a class and need to write your logic like below:

    /// <summary>
    /// Custom routing event handler for Music Festival.    
    /// </summary>
    public class CustomContentApiRoutingEventHandler : RoutingEventHandler
        public CustomContentApiRoutingEventHandler(
            IContentRouteEvents routeEvents,
            ServiceAccessor<HttpContextBase> httpContextAccessor,
            ContentApiRouteService contentApiRouteService)
            : base(routeEvents, httpContextAccessor, contentApiRouteService)

        // If language does not exists in the routing context, we return ContentLanguage.PreferredCulture as default language
        protected override string GetLanguage(SegmentContext routingContext, HttpRequestBase request)
            var language = routingContext.Language ?? routingContext.ContentLanguage ?? ContentLanguage.PreferredCulture.Name;
            return language;
Edited, Sep 16, 2020 4:47

Thank you, I will try and see if this will help. 

Sep 16, 2020 8:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.