facebook  linkedin  Twitter  skype  Rss googlePlus

Developing Custom Applications with DotNetNuke

Feb 05 2006
3286

The majority of custom applications require security with users, roles, etc. well DotNetNuke is the perfect structure for writing custom applications. Why? you say, well Imagine having a tool which will allow for forms, windows, or LDAP authentication and an impeccable infrastructure for roles/groups allowing module-level security, that's right, not just page level but module level security. Also, DotNetNuke 4 supports ASP.NET 1.1 and 2.0 so you can easily re-use your code without re-inventing the wheel.

In this article I am going to show how, as a .net developer, you can use any .NET language to create custom applications using the DotNetNuke framework by accessing the two basic necessities in any custom application: username and role.

Assumptions:

You know how to create user controls in ASP.NET 2.0 and/or 1.1

Resources:

Article:

Step1. Create a UserControl in your project/website:

Step2. Add a Label to the UserControl:

Step 2a. Add a Reference to the “DotNetNuke.dll”

Step3. Now copy and paste this code into your usercontrols Page_Load Procedure (this is in VB.NET)

        Dim mRoles As New DotNetNuke.Entities.Users.OnlineUserInfo
        Dim mUserRoles As New DotNetNuke.Security.Roles.RoleController
        Dim mUser As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo
        Dim showroles As String = ""
        For Each i As String In mUserRoles.GetRolesByUser(mUser.UserID, mRoles.PortalID)
            showroles += i.ToString() & ","
        Next
        Me.Label1.Text = "UserName: " & mUser.Username
        Me.Label1.Text += "
FullName: " & mUser.FullName
        Me.Label1.Text += "
UserID: " & mRoles.UserID.ToString
        Me.Label1.Text += "
Roles:  " & showroles

Step5. Load SmartDNNModule into your portal (follow the instructions that comes with smartdnnmodule)

Step6. Add SmartDNNModule onto a Page

Step7. In the Two Text Boxes type in: “WebUserControl.ascx” then click “Create Module”

Step8. Login in as a user

Step9. Click on the page where you loaded SmartDNNModule

Step10. You now know how to access everything to create a custom application (by exploring the classes that I have shown, you will reveal many useful functions and procedures in the DotNetNuke framework): 

About the Author:

Charles Stratton has been programming since 1999 and enjoys staying on the edge of technology. his skills range from DNN to Sharepoint to Custom Development. currently working in VB.Net and C#.Net web and software. KISS - Programmers work smarter not harder. Charles can be reached at stratcr@peoplepc.com.

About the Author, Patrick Santry

Patrick Santry, has two decades of experience in enabling businesses to take advantage of the digital landscape. A well rounded experience in technology, and business is what sets me apart from the rest of the pack. When it comes to an overall digital strategy my experience is impressive.

BS in Computer Information Systems. Four time recipient of the Microsoft MVP Award, and author of several books and magazine articles on digital technologies.


blog comments powered by Disqus

Latest Podcast

New Podcast: Why Go Mobile?

 

Subscribe to Pat's Digital Podcast on iTunes! Latest Podcast

Listen to Pat's Podcast

 

Thank you for visiting our site, before you leave, please visit some of the areas or information you may have missed.