Kentico 12- MVC is Here to Stay

By: Matt Reale | Link to the full article

The brand-new Kentico 12 brings with it a wealth of new features and functionality to make it even more attractive to marketers and IT departments. A lot of these are underneath the hood but really speak to the way that Kentico is revamping their platform to use the latest technology stacks. In this post we’ll take a deeper dive into the newest MVC side of Kentico 12.

The biggest update to Kentico is a more full-fledged support of MVC-style development. For those who are less technically-inclined, MVC (Model-View-Controller) is a development methodology introduced to several years ago and is generally seen as the next-generation of how sites are built. While Kentico introduced some MVC features as far back as Kentico 8, many of the best parts of Kentico (dynamic page and form building to name a few) were absent from the platform. In most cases this led us to continue to recommend using the Web Forms-based Portal pages as it really leveraged the flexibility of Kentico’s portal engine to be able to dynamically create and design pages with minimal coding.

With the release of Kentico 12, however, much of that changes. K12 allows developers to create editable zones and widgets to allow an editor to dynamically compose the layout of a page. It also ships with several standard widgets (similar to the widgets and webparts that come bundled as part of Portal Pages).


Moving a site from webforms to MVC is a non-trivial task. There are some big shifts in thinking that Kentico customers will need to make- long gone will be the days of page templates, web parts, and page layouts. In some cases pages will be more structured than they previously were in the past since many functions will be moved out of the Kentico administration console and into the hands of the developer. While this has downsides- quick tweaks may be less quick- it also has benefits: testability, reliability, and performance.

One of the largest structural changes for any Kentico MVC project (K12 is no exception) is that Kentico MVC projects have two .net solution files. This means, from a practical perspective, that the content administration section of Kentico and the client-facing website are separated into two distinct websites. While this can seem sub-optimal at first blush, it really provides some practical benefits.

Separation of Concerns: by having your presentation layer physically separated from the CMS layer, you can improve security and reliability easily.
Improved deployment speeds: Since we’re no longer deploying the whole content management system every time we build, we gain speed in two ways: 1: the Kentico administration tool never gets knocked down when we deploy. This might seem like a minor issue but when you’re deep in the trenches of a site build, every minute counts and downtime due to deployment can be a major source of frustration for editors who are under the gun. 2: we are deploying a much smaller solution to the client-side which means that startup is markedly faster.
Testability: Web forms is notoriously hard to test programmatically. By separating out the MVC portions of the site, we can use automated testing to reduce both the amplitude and frequency of bugs.


Page display will now be controlled via MVC routing- these routes are set up (for now… see below for more info on this) at a Page Type level by setting up a URL pattern. (you can learn more about Kentico’s MVC page URLs here:

In this case this page will then use the Articles Controller below using the nodeGUID and the pageAlias to determine the right content for the page, will display the content using the default view for this action, namely the view in the Views/Articles folder named Show.cshtml.


Earlier in this post I mentioned that widgets were a new part of Kentico 12 MVC. In the past, clients were either tied to very specific structured templates or developers had to really try to bend Kentico to their will with a lot of custom code in order for editors to be able to create dynamic pages. Now, however, we have Kentico Page Builder, which aims to reduce the friction of creating dynamic Kentico webpages in an MVC environment.


The real change in Kentico 12 is the editable area and the widget. Editable areas allow developers to define spaces in the template where editors can add widgets and sections. In the screenshot below, you’ll see an example of an editable area. Kentico has some HtmlHelper functions for this.

The important part for this all to work is to wire it up in the controller:

So what does this give us? The ability to add the new MVC widgets to the page:

MVC widgets are defined in code and, like any other piece of functionality in MVC, have a model, view , and controller associated with them. Widgets are registered via a special attribute as seen in the screenshot below:

The Index() action is used to generate the viewmodel and display the data.

Finally, page builder sections allow editors to add dynamic areas to the page where they can define column layouts. This gives the editors more flexibility when laying out pages.

I’d recommend taking a look at the Dancing Goat MVC sample from Kentico to take a deeper dive into the code and site if you’re interested.


The next big piece of Kentico 12 MVC that is coming soon is full-fledged page aliasing. Right now, we are limited to standard routing but page aliases will be released in a service pack in the spring of 2019. Once this is complete they will have replicated or replaced pretty much every piece of core Kentico Web Forms functionality.
Kentico has announced with Kentico 12 that it will be the last Kentico release with full Portal Pages support, and that they will be de-supporting Portal Pages when Kentico 12 is sun-setted in 2022. This really provides a strong impetus to move to Kentico MVC for your next project, especially if your typical redesign cycle is longer than 4 years! To learn more about Kentico 12 MVC, contact us today!

iMedia is a strategic interactive agency. We create, design and produce integrated and results driven digital brand experiences.