Hello all,
I am very new to DNN though I've been programming in asp.net for a few years and I'm not understanding how modules behave in DNN. We are using 4.08.04.
I've created a new module in visual studio using the starter kit called TestModule. (File --> New File --> Dot net nuke dynamic module).
I altered the ViewTestModule.ascx Page_Load fuction to call the following code that displays information about the logged in user:
DotNetNuke.Entities.Users.OnlineUserInfo mRoles = new DotNetNuke.Entities.Users.OnlineUserInfo();
DotNetNuke.Security.Roles.RoleController mUserRoles = new DotNetNuke.Security.Roles.RoleController();
DotNetNuke.Entities.Users.UserInfo mUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();
string showroles = string.Empty;
foreach (string i in mUserRoles.GetRolesByUser(mUser.UserID, mRoles.PortalID))
{
showroles += i.ToString() + ",";
}
lblTest.Text = "UserName: " + mUser.Username;
lblTest.Text += "<br> FullName: " + mUser.DisplayName;
lblTest.Text += "<br> UserID: " + mRoles.UserID.ToString();
lblTest.Text += "<br> Roles: " + showroles;
This works fine when I log in as host, the page_load event fires everytime. However if I log out then log in as admin or another user, the page_load event on the user control does not fire. It makes no sense. I tried setting the caching for the module to -1, that didn't help. It seems like the code itself is behaving differently if I'm logged in as "host". Any clues as to what I'm missing here?