Configuring the MVC application

This page is a part of a tutorial, which you should follow sequentially from beginning to end. Go to the first page: Using the Xperience interface.

In the previous step of this tutorial, you have installed the Xperience instance that will serve as your site’s content repository and the associated MVC project you will use to present your site. In this step, you will configure the MVC application by enabling the content tree-based routing and page builder features via the ApplicationBuilder class. The MVC application is used to serve the content managed by Xperience to regular users.

With content tree-based routing, the system automatically generates and matches page URLs based on their position in the website’s content tree (demonstrated further in the tutorial). You do not need to perform any manual route mapping and configuration on the side of the MVC application. All routing logic is handled for you by the system. We will set up the pages on our tutorial website using this approach.

The page builder feature enables non-technical users to manage page content via an intuitive drag-and-drop interface. When using the page builder, editors work with widgets – predefined, configurable pieces of content prepared by the developers.

Integrating the page builder is a multistep process that you will be guided through during this tutorial.

Configuring the MVC project

  1. Open the MEDIOClinic.sln solution in Visual Studio.

    • The solution is located in the path set by the Target location option during the installation process: C:\inetpub\wwwroot\Xperience13
  2. In the App_Start folder, edit the ApplicationConfig.cs file.

    • The ApplicationConfig class is included as part of the MVC project created by the Xperience installer and you can use it to selectively enable Xperience features in the MVC application. The class’s RegisterFeatures method is called in the Application_Start method of Global.asax by default, ensuring all configured features are automatically enabled when the site starts.
  3. Uncomment the builder.UsePageBuilder() line in the RegisterFeatures method. You can also see that the project template also by default calls builder.UsePageRouting(), which enables the content tree-based routing feature. The ApplicationConfig class should now contain the following code:

    
    
    
     using Kentico.Web.Mvc;
     using Kentico.Content.Web.Mvc;
     using Kentico.PageBuilder.Web.Mvc;
    
     namespace MEDIOClinic
     {
         public class ApplicationConfig
         {
             public static void RegisterFeatures(IApplicationBuilder builder)
             {
                 // Enable required Kentico features
    
                 // Uncomment the following to use the Page builder feature
                 builder.UsePageBuilder();
    
                 //builder.UseScheduler();
                 builder.UsePageRouting(new PageRoutingOptions
                 {
                     //EnableAlternativeUrls = true
                 });
             }
         }
     }
    
    
     
  4. Rebuild the MEDIOClinic solution.

You are all set! Your MVC application is now configured, and you can start building your site’s pages in the next step.

Previous page: Installing Xperience — Next page: Creating page types

Completed pages: 3 of 10