Blog Author

With over 20 years of technical experience and 15 years on the Microsoft enterprise, Jamel Clarke has extensive experience in the areas of design, architecture and development. Jamel has participated in various projects in a range of technologies from web-based ASP.NET MVC applications to middle-tier services.

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.

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.

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

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

to:

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:

Add this code to the code behind:

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:

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

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

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

Click save.

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

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.

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.

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.