New DNN developers often wonder how to expose information about logged in users to a custom DotNetNuke module. So, I threw together a very simple example to show how easy it is to begin using the built in user information features found in DotNetNuke.
First, I created a simple user control with nothing but a label on it:
<asp:Label ID="Label1" runat="server" Style="position: relative" Text="Label"/>
Then, on the codebehind, I added the following:
Imports DotNetNuke
ImportsDotNetNuke.Entities.Users
Imports System.Web.UI
Namespace Template
Partial Class UsersStuff
Inherits Entities.Modules.PortalModuleBase
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
If Not Page.IsPostBack Then
'Hide update buttons from users not assigned to particular security groups
If Not PortalSecurity.IsInRole("Registered Users") Then
Label1.Text = "You must be registered to see this message"
Else
Dim uInfo As UserInfo = UserController.GetCurrentUserInfo()
Label1.Text = "Hi, " & uInfo.DisplayName & " & _Is this still a valid address? " & uInfo.EmailuInfo." and watch to see what methods the intellisense brings up to you for more user infomration.
"
'type "
End If
End If
Catch ex As Exception
ProcessPageLoadException(ex)
End Try
End Sub
End Class
End Namespace
Finally, I dropped the module on a test page and here is a picture of the output:

And, that's how easy it is to get started with the UserInfo classes. DotNetNuke makes it easy to personalize your user experience