Configuring the MVC application

This page is a part of a tutorial, which you should follow sequentially, from the beginning to the end. Go to the first page: Getting started with Kentico.

In the previous step of the tutorial, you have installed the Kentico instance that will serve as your MVC site’s content repository and the associated MVC project you will use to present your site. In this step, you will configure the MVC project by enabling preview mode support and the page builder feature via the ApplicationBuilder class.

Preview mode in Kentico provides a way for your editors to view the MVC pages in the Kentico administration interface. With the correct implementation, the preview mode also shows the latest version of pages even before they are published to the live site (this topic is not covered within this tutorial).

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\Kentico12
  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 Kentico installer and you can use it to selectively enable Kentico 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.UsePreview() and builder.UsePageBuilder() lines in the RegisterFeatures method. 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
    
                 // Enables the Preview mode functionality, which allows your website editors to preview
                 // the content of the MVC site's pages from the Kentico user interface.
                 builder.UsePreview();
    
                 // Enables the page builder feature, which allows editors to compose page content via
                 // page builder widgets on preconfigured pages.
                 builder.UsePageBuilder();
             }
         }
     }
    
    
     
  4. Build 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 Kentico — Next page: Creating content-only page types

Completed pages: 3 of 10