dotnetnuke custom module development

Recently, i started working on a project using the ASP.NET based portal framework dotnetnuke. My part is mainly the development of custom modules. Although the framework’s architecture makes it easy to extend the functionality, the available documentation is far from being complete. Finding necessary hints and tipps in discussion boards and blogs, i’ll try to do my part offering useful tipps for developers.

Accessing current portal settings (C#)
if you plan to use elements of the current active skin of the portal in the views of your module, you need an instance of the current portal settings.

PortalSettings settings = (PortalSettings) HttpContext.Current.Items["PortalSettings"];

So if you want acces to your skin path, this is the way you go:

String path = settings.ActiveTab.SkinPath;

Accessing the portal’s active culture
You may need the current active culture (language settings) in your module. Dotnetnuke uses built-in .NET localization, but it’s not so obvious
how to get the current setting – you have to fetch it from the current thread:

CultureInfo culture = Thread.CurrentThread.CurrentUICulture;

e.g. the following will return “en-US” for standard english culture


Using API for sending e-mails

A simple example using the default settings configured in the portal backend:
DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, SendToAddress, "", "my subject", "this is the mailbody", "", "", "", "", "", "");

The official documentation for module development can be found here!

Leave a Reply

Your email address will not be published. Required fields are marked *