Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem Viewing Module After Role Assignment During RegistrationProblem Viewing Module After Role Assignment During Registration
Previous
 
Next
New Post
4/27/2009 2:41 PM
 

I have created a custom user registration module for my portal, and one part of the functionality is to assign roles to users depending on certain demographic information.  However, I am having a problem where after registration, when the user is directed to the home page, a certain text module does not appear for the user, even though they have permissions to view it.

I'm getting a list of roles based on the demographic information of the user, and then manually adding the user to the roles.  Then I log the user in and redirect them to the home page:

 If arrRoles.Count > 0 Then
   For Each roleID In arrRoles
       objRoleController.AddUserRole(PortalId, objSSO.UserID, roleID, New DateTime)
    Next
End If

UserController.UserLogin(PortalId, objNewUser.Username, txtPassword.Text, "", PortalSettings.PortalName, "", loginStatus, False)
    If loginStatus = UserLoginStatus.LOGIN_SUCCESS Then

        Response.Redirect(NavigateURL(PortalSettings.HomeTabId), True)

End If

Has anyone ever had problems viewing modules that have certain permissions after registering on a DNN portal?

 
New Post
4/28/2009 8:17 AM
 

User roles are cached client side in DNN to help with server performance.
The cache is created when the user first logs onto the server - and are passed as a cookie.

Now while this is a nice idea for generic sites - it can fall apart when you try to do anything interesting - like dynamically adding roles etc.

In your case the issue most likely relates to the cache not being created as you would expect - or when you expect. 
You may wat to try  firing off a clearUserCache - AFTER - you automatically log the user on - and before you call the response.redirect.

To force DNN to build the cache correctly.

'UserController.UserLogin(PortalId, UserInfo, PortalSettings.PortalName, GetIPAddress(), True)
Dim objUser As UserInfo = UserController.GetCachedUser(PortalSettings.PortalId, Context.User.Identity.Name)
If objUser IsNot Nothing Then
    DataCache.ClearUserCache(PortalSettings.PortalId, Context.User.Identity.Name)
End If

Westa

 
New Post
4/28/2009 8:35 AM
 

Missed a line - you also need:

DotNetNuke.Security.PortalSecurity.ClearRoles()

Westa

 
New Post
5/5/2009 7:11 PM
 

Does it matter when I call ClearRoles()?  Does it have to be before or after ClearUserCache() ?

 
New Post
5/5/2009 7:33 PM
 

It still doesn't work for me.

One thing about the code you posted, for the username parameter, you passed Context.User.Identity.Name.  When I tried running this code, the name was blank, so I tried passing through the username of the new user I had just created.  Does that make a difference?  Is there a reason you're using Context.User.Identity.Name?

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem Viewing Module After Role Assignment During RegistrationProblem Viewing Module After Role Assignment During Registration


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out