Skip to main content

Kentico: Custom Module Development

Overview

Kentico CMS for ASP.NET is a flexible and powerful Content Management System (CMS).  Kentico is extensible via several methods, one of which is custom module development. In this post, I will demonstrate the general process of building a custom module in Kentico. Digital marketing companies have been using QR Codes as a marketing tool for quite some time to drive customers to web sites from print media via smartphone. A QR Code generator would make a nice Kentico custom module. Let’s see how we would accomplish this.

Kentico: Custom Module Development

Setting Up A Custom Module in Kentico

Locate the CMS source in my case c:\inetpub\wwwroot\kenticocms7. Open the WebApp solution, and in solution explorer, find the CMSModules.

Kentico: Custom Module Development

Open the CMS Modules folder and create a new folder called QR Code, and within the QR Code folder, add another folder called Tools.

Kentico: Custom Module Development

Add a new web form called QR CodeGenerator.aspx. Open the code behind QR CodeGenrator.aspx.cs file and change the line from:

Kentico: Custom Module Development

to:

Kentico: Custom Module Development

This will make the page only accessible from the CMSDesk. Remember to resolve all dependencies.

Kentico comes with a reference to Thought.Works.QR Code that I will be using. Kentico also comes with a global http handler that has logic for creating QR Codes, but this isn’t integrated into the toolset as a module.

Add the following code to the QR CodeGenerator page:

Kentico: Custom Module Development

Add this code to the code behind:

Kentico: Custom Module Development

Build the solution and then start the Kentico site. Log in to the site manager. Click on the development tab, then the modules item in the treeview. Click the new module button. Add the values below:

Kentico: Custom Module Development

Click save. Under the sites tab, add the sites you want the module to be registered with.

Kentico: Custom Module Development

Under the permission names tab, add the following and click save.

Kentico: Custom Module Development

Kentico: Custom Module Development

Under the user interface tab, associate the module with the QR CodeGenerator.aspx page. 

Kentico: Custom Module Development

Click save. 

Click on the roles tab and add roles to allow for use of this custom module.

Kentico: Custom Module Development

Go to CMSDesk and click the administration tab, and then the permissions button. Select the QR Code Generator from the modules dropdown box and allow CMS Basic users access to the Generate task.

Kentico: Custom Module Development

And the end result, type a URL or text content in the text box, click the button, and your QR Code is generated. You can now save the QR Code image as you would any other image, and embed it in other web pages or print media.

Kentico: Custom Module Development

In conclusion, Kentico shows its power and simplicity to give members of your team powerful tools leveraging your current .NET/ASP.NET skillset. You can take utilities from current ASP.NET applications with a few lines of code changes and some Kentico configuration. Furthermore, with just a few more code changes, you can take any of the powerful utilities you have written in .NET and port them to Kentico.

Author:
Solution Category:
Speciality Category: