Learn More





DNN Community Blog

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.

DotNetNuke Tips and Tricks #12: Creating your own Authentication Provider

AuthProviderDemoLogin DotNetNuke has a lot of great features that come built-in, but there are often situations where the default implementation is not what the customer wants for their website.  This was a big limitation of early versions of DotNetNuke – changing basic functionality often required the user to customize the core DotNetNuke code.

In DotNetNuke 2.0 all of that began to change with the introduction of Providers in the framework.  This is also where we began focusing on a rich extensibility model that would allow users to install skins, skin objects, and modules as separate packaged extensions.  Over time, the framework has evolved to include different extension types, and in DotNetNuke 5.0 we moved to a unified extension model that treats all extension types in a similar manner during the install and uninstall process.

One of the extension types that was added in the last couple of years was the Authentication Provider.  Unlike most other providers, an authentication provider is not configured in the web.config and actually looks and behaves more like a module than an actual provider.

LiveLoginAn authentication provider installs up to 3 UI elements that the framework cares about – a login control, a settings control and optionally a logout control.  It is certainly possible to use more controls if needed, but these are the only three the core framework interacts with directly. Once installed the authentication provider can appear as one option in the standard DNN login.  In the image to the left you can see the standard login on with the LiveID tab selected.  This clearly shows a different UI than the standard username and password.

Recently there has been a lot of discussion around a change made to recent versions of DotNetNuke.  In the past, it was possible to define a custom login page and put the Account Login module on the page.  This allowed you to create an SSL enabled login page or to put a login control directly on the home page.  Unfortunately, users would sometimes change the custom login page setting without putting a login module on the page.  In other cases, the login module would be added to the page, but the user wouldn’t have permission to see the page or the control.  Recent versions of DotNetNuke try to detect this situation and prevent you from setting the custom login page to a location without a login control that is visible to unauthenticated users.

Unfortunately, there are a number of third party login modules currently on the market which are not implemented as Authentication Providers and this new behavior makes it impossible to use them with the latest DNN release.  We’ll work on the behavior change to make it possible to use these modules but I thought that this highlights one of the issues with DNN.  When we introduce an official extensibility point, we then start coding the core to use and rely on extensions which conform to the extensibility model.  If you are coding a skin object that doesn’t conform to the official model then we may well break your skin object in future DNN releases.  The same is true with Authentication Providers.  Had these modules been code as Authentication Providers instead of Modules then they would have continued to function.

The real failure in this case rests with the core team and not the module vendors.  When we introduce new features we often haven’t had the resources to fully document how to take advantage of the new feature.  This is especially true for core API changes.  The end result is that the core team ends up coding to the new APIs long before 3rd party vendors start upgrading their extensions.  The biggest reason for this is because we haven’t done a good enough job in documenting how to use the new feature.

With all of this as background, I thought it would be good to run through exactly how to create your own custom Authentication Provider.  In this example, I am going to start from the standard DotNetNuke Authentication Provider.  For the sake of simplicity, I am going to code this as a WSP project, although the techniques apply just the same to a WAP project (LiveID, OpenID and AD providers are all WAP based implementations).

AuthProviderDemo The first thing I do is make a copy of the DNN Authentication provider which is located in the DesktopModules/AuthenticationServices/DNN folder.  I have renamed my copy to Demo so that we can distinguish it from the original.  I have gone into the Login and Settings controls and changed the namespaces to avoid collision and changed them from DotNetNuke.Modules.Admin.Authentication to DotNetNuke.Modules.Admin.Demo.Authentication.

At this point I have a useable Auth Provider, but I don’t have a method to install it.  I could use the Host/Extensions page to create a new package but since this is my first time I decided to build my manifest file using the manifest from the LiveID Authentication Provider as a template.  After making a few modifications to the manifest to add a CSS file (more on that in a minute) and to fix some file names, I am almost ready to zip everything up.

<dotnetnuke type="Package" version="5.0">
        <package name="DNN_DemoAuthentication" type="Auth_System" version="01.00.00">
            <friendlyname>DotNetNuke Demo Authentication Project</friendlyname>
            <description>The DotNetNuke Demo Authentication Project is an Authentication provider for DotNetNuke that shows how easy it is to create your own custom auth provider.</description>
                <name>DotNetNuke Corporation</name>
                <organization>DotNetNuke Corporation</organization>
                <email>[email protected]</email>
            <license src="license.txt" />
            <releaseNotes src="ReleaseNotes.txt" />
                <dependency type="CoreVersion">05.00.00</dependency>
                <component type="AuthenticationSystem">
                <component type="File">

Before packaging the system however, I want to make some changes to the login controls just to make it a little clearer when I am using my new control versus the standard DNN version.  The DNN login uses tables for handling the form layout, and I am going to use a definition list.  I also want to get rid of the help icons next to the form labels and use some different styling on the actual textboxes.  Finally, I want to get rid of the Captcha control.

The first step is to clean up the login HTML

<%@ Control language="vb" Inherits="DotNetNuke.Modules.Admin.Demo.Authentication.Login" CodeFile="Login.ascx.vb" AutoEventWireup="false" Explicit="True" %>

<dl id="DemoLogin">
    <dt><asp:label id="plUsername" controlname="txtUsername" runat="server" resourcekey="Username" /></dt>
    <dd><asp:textbox id="txtUsername" columns="9" width="150" cssclass="NormalTextBox" runat="server" /></dd>
    <dt><asp:label id="plPassword" controlname="txtPassword" runat="server" resourcekey="Password" /></dt>
    <dd><asp:textbox id="txtPassword" columns="9" width="150" textmode="Password" cssclass="NormalTextBox" runat="server" /></dd>
    <dt id="verifyLabel" runat=server visible="false" ><dnn:label id="plVerification" controlname="txtVerification" runat="server"/></dt>
    <dd id="verifyControl" runat=server  visible="false"><asp:textbox id="txtVerification" columns="9" width="150" cssclass="NormalTextBox" runat="server" /></dd>
<asp:button id="cmdLogin" resourcekey="cmdLogin" cssclass="StandardButton" text="Login" runat="server" />

After making these changes I make the corresponding changes in my code-behind to remove references to the captcha control and to update the visibility code for the verification control/label.  This is pretty much all that is needed for the Login control.

The next set of changes are made to the settings control.  We need to make sure that we are saving our control settings using unique settings keys (although you are free to store your settings using whatever method you are comfortable with).  In this case I create a new DemoAuthConfig class to replace the core AuthenticationConfig class.  I then go back and update the settings and login pages to reference my new config class rather than the old class.  I also remove all references to the captcha setting since I am not using it here.

Finally, I want my login control to have it’s own look which I may choose to surface on the settings page at some point.  To handle this I include a CSS file in my project since I don’t want end users to have to muck around trying to edit core CSS files.  My CSS file changes the way the definition list is displayed to show up as two columns.

One last bit that I need to update is to edit the login.ascx.resx resource file.  This resource file contains the Title.Text resource which controls the tabname that is used when displaying the various login controls.  In my case I used “Demo Auth” for my Title.Text.

At this point I am ready to package everything up in a zip file so that it is ready for installation.  Installing an authentication provider in DotNetNuke 5.0 is exactly the same as installing a module.  Navigate to the Host/Extensions page and select the “Install Extension Wizard” option from the module action menu.  This will walk you through the installation process.

Once the provider is complete, you will need to go to the Host/Extensions page and edit the new Authentication Provider settings to make sure it is enabled (it should be enabled by default).  To edit the settings, click the edit (pencil) icon next the the DNN_DemoAuthentication extension listing.


You should see the following settings which allow you to enable or disable this authentication provider for all portals.


Once the provider is enabled at the Host level, you are now free to go to each portal and enable the provider for each portal where you wish to use it.  Just go to the Admin/Extensions page and click on the edit (pencil) icon for the demo auth provider to bring up our custom settings page.  Now we can enable our new AuthenticationProvider.



If you have followed along to this point, when you go to the login page, you should see two authentication types – Standard and Demo Auth.  If you look at the Demo Auth page, you will notice that the “help” icons are removed and the text boxes are displayed  using a custom style.


At this point you should be ready to create your own custom Authentication provider which plugs into the standard login system.  This is the recommended method for providing custom layouts and authentication types for DotNetNuke and I highly recommend you check it out.

Download the demo code


Joseph Craig

The link is broken as of 2/9/2014. Any chance of getting that fixed?
Joseph Craig Sunday, February 09, 2014 7:42 PM (link)
Jonathen Richter

Your link still does't work in the above comment.

Jonathen Richter Monday, February 24, 2014 8:28 PM (link)
Apeksha Shah
Here is a link to that works -
Apeksha Shah Monday, May 12, 2014 10:38 AM (link)
Karl Jackson
Is this approach still valid for DNN7.4?
Karl Jackson Wednesday, March 25, 2015 10:39 AM (link)
cathal connolly
@Karl , yes, it still works fine
cathal connolly Wednesday, March 25, 2015 10:41 AM (link)
Karl Jackson
Thanks cathal. Is there a C# version of the .zip file?
Karl Jackson Wednesday, March 25, 2015 11:42 AM (link)
cathal connolly
@Karl, I don't think so - if you want to see similar c# code then the platform source is a good resource e.g.
cathal connolly Wednesday, March 25, 2015 11:51 AM (link)
Does anyone know if this works with the free dnn version 8.0? Also the links to the sample project is no good. My google foo is weak on finding a solid step by step guide. It sure would be nice if Chris had a template I could install and use for custom auth providers. I am trying to create a Active Directory provider.

any and all information is appreciated! 73s
cneovyper Tuesday, February 16, 2016 9:39 PM (link)

Comment Form

Only registered users may post comments.


2sic Daniel Mettler (124)
Aderson Oliveira (15)
Alec Whittington (11)
Alex Shirley (10)
Andrew Nurse (30)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (21)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (203)
Chris Paterra (55)
Clinton Patterson (28)
Cuong Dang (21)
Daniel Bartholomew (2)
Dave Buckner (2)
David Poindexter (3)
David Rodriguez (2)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (74)
Geoff Barlow (6)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (269)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matthias Schlomann (15)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Mike Horton (19)
Mitchel Sellers (28)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Peter Donker (52)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott S (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Timo Breumelhof (24)
Tony Henrich (3)
Torsten Weggen (2)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (37)
Will Strohl (163)
William Severance (5)
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?