AI OnAI Off
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;
}
}
Hi!
In this example, https://world.episerver.com/documentation/developer-guides/content-delivery-api/content-delivery-api-and-episerver-forms/ there is a reference to CustomContentApiRoutingEventHandler and we have added these namespaces:
and it is still missing...
Anyone got a clue?