A forgotten post : Registring a Custom Module with Sitefinity

June 14, 2007 Digital Experience

Over the last week or so I’ve received several comments asking how to register a custom module in Sitefinity. Obviously, this post should have been written way before in the Building a pluggable module section, but I have somehow missed it. I apologize and would like to thank the kind readers that pointed that out.

So here it goes… registring the module with Sitefinty. In case you have not already downloaded the latest download of Contacts Module project, you can do it here . The zip file contains two projects : Sample.Contacts and Sample.Contacts.Data.

You need to add both of those projects to your existing project in Visual Studio in effect creating a solution. If you already have a solution, just add those two projects. Then add both projects as a reference to the WebSite project (Sitefinity website).

Now that you have that project, let’s see what we need to do to register it.

1. You should add the config section for contacts module to your web.config. So find in your web.config <configSections> element, and then inside if <sectionGroup name=”telerik”> element. Paste the underline line inside that element.

<configSections>
<sectionGroup name =“telerik>
<section name =“contacts“
type =“Sample.Contacts.Configuration.SectionHandler, Sample.Contacts“
requirePermission =“false“/>
</sectionGroup>
</configSections>

Sample.Contacts is the name of the project. SectionHandler is the class inheriting the base class ConfigurationSection and contains the functionality for loading and accessing the contacts section information.

2. Add the contacts section inside of telerik section group.Your contacts section will allow you to set various settings required by Contacts module. So find the <telerik> element and past the underlined text somewhere inside it (be careful <telerik> element must be a immediate parent of <contacts> section here).

<telerik>
<contacts defaultProvider =“Sitefinity“>
<providers>
<clear/>
<add name =“Sitefinity“ securityProviderName =“”
type =“Sample.Contacts.Data.DefaultProvider, Sample.Contacts.Data“
connectionStringName =“DefaultConnection“ visible =“true“ />
</providers>
</contacts>
</telerik>

As you can see the first and most rudimentary setting we need to set is the provider for this module. Sample.Contacts.Data is the data project for the Contacts module and DefaultProvider is the class providing an implementation for the provider model.

3. Finally, you have to register the module. The previous two steps were needed by the module, this last step actually registers the module with Sitefinity. Find the <framework> element and then <modules> element inside of it. Paste the underlined line inside of <module> element.

<framework>
<modules>
<add type =“Sample.Contacts.ContactsModule, Sample.Contacts“/>
</modules>
</framework>

ContactsModule is the class, providing substantial information for your custom module. In my previous posts I’ve referred to this class as the main module class also. That’s the one inheriting WebModule class.

That’s all. Let me know if you need any other assistance.

The Progress Team