Enabling Xperience features in ASP.NET Core applications

In Xperience, some features provided by the system need to be explicitly enabled on the side of the front-end ASP.NET Core application. This is an intentional design choice that allows you to enable and configure only the features you end up integrating. Individual features register additional middleware and routes; having all features enabled by default would unnecessarily impact application performance.

Features are enabled within the ConfigureServices method of the application’s startup class. The IServiceCollection.AddKentico method that adds Xperience classes to the service container optionally takes an IFeaturesBuilder delegate where you can enable individual system features. Each feature is enabled with a corresponding Use*FeatureName* extension method:

Application startup class



public void ConfigureServices(IServiceCollection services)
{
    ...

    services.AddKentico(features =>
    {
        features.Use*FeatureName*();
    });

    ...
}


The following table provides an overview of all features that can be enabled: 

Feature

Extension method

Description and additional notes

Page builder

UsePageBuilder

(Kentico.PageBuilder.Web.Mvc)

See Page builder development for more details and additional configuration options.

Content tree-based routing and alternative URLs

UsePageRouting

(Kentico.Content.Web.Mvc.Routing)

Content tree-based routing is enabled automatically by calling UsePageRouting. The site’s routing mode also must be set to Based on content tree under Settings -> URLs & SEO -> Routing mode in the Xperience administration application.

To enabled the alternative URLs feature, pass a PageRoutingOptions object to the method and set the EnableAlternativeUrls property to true:




features.UsePageRouting(new PageRoutingOptions
    {
        EnableAlternativeUrls = true;
    });


If you only want to enable alternative URLs, you need to explicitly disable the routing feature:




features.UsePageRouting(new PageRoutingOptions
    {
        EnableAlternativeUrls = true;
        EnableRouting = false;
    });


See alternative URLs configuration for information about ways to further configure this feature.

Scheduler

UseScheduler

(Kentico.Web.Mvc)

Requires scheduled tasks to be enabled in Settings -> System -> Enable scheduled tasks within the Xperience administration.

You also need to configure individual site-specific scheduled tasks to run on the live site in the Scheduled tasks application.

See Processing scheduled tasks on the live site for more information.

A/B testing

UseABTesting

(Kentico.OnlineMarketing.Web.Mvc)

Requires A/B testing to also be enabled in Settings -> On-line marketing -> Enable A/B testing within the Xperience administration.

You also need to add logging scripts to your site’s pages. See Enabling A/B testing.

Campaign logging

UseCampaignLogger

(Kentico.CampaignLogging.Web.Mvc)

To support all campaign conversion options, logging of membership and page-related activities must be enabled. See Logging activities.

Marketing email tracking

UseEmailTracking

(Kentico.Newsletters.Web.Mvc)

When a recipient opens a marketing email from Xperience or clicks a link in its content, a hidden request is sent to the front-end Core site. Routes registered by the UseEmailTracking method ensure that the tracking data is processed and logged into the shared Xperience database.

User activity tracking

UseActivityTracking

(Kentico.Activities.Web.Mvc)

Required for page-related activities that need to be logged manually in your code. See Logging activities for more information.

Web Analytics

UseWebAnalytics

(Kentico.OnlineMarketing.Web.Mvc)

Requires web analytics to also be enabled using the settings in Settings -> On-line marketing -> Web analytics within the Xperience administration.

You also need to add logging scripts to your site’s pages. See Enabling web analytics.