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

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationGetUserRole MethodGetUserRole Method
Previous
 
Next
New Post
5/2/2008 8:25 PM
 

I am trying to use GetUserRole method in my page. However there is an error message saying that  "Reference to a non shared member requires an object reference". What am i doing wrong. However it tells me correctly that there are 3 parameters (portalid, userid and roleid) required. Where do i need to instantiate it?

 
New Post
5/3/2008 9:57 AM
 

Hi Mzubair10,

The GetUserRole method of the RoleController class is not a shared (static) method.  As such, you'll need to instantiate the class prior to calling it, as:

Dim controller as New RoleController()

UserRoleInfo info = controller.GetUserRole(portalId, userId, roleId)

 

Hope this helps!

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
5/5/2008 11:51 AM
 

Thank you so much Brandon. That worked! However, I am facing this issue. I am trying to get the role info for the role "Registered User". Code looks something like this

Dim roleinfoObj As New DotNetNuke.Security.Roles.RoleInfo
Dim contoller1 As DotNetNuke.Security.Roles.RoleProvider
roleinfoObj = contoller1.GetRole(PortalId, "Registered Users")

         The error message is "controller1" needs to be be assigned a value before it can be used.  All i am trying to do is get the roleId for the role "Registered User". Please let me know if there is a simpler way or what i am doing wrong with the above code. Thanks in advance.

 

 
New Post
5/5/2008 12:32 PM
 

Got a tempory solution though to the above problem. I created an instance of the roleprovider class and assigned that to controller. Code looks something like this

contoller1 = DotNetNuke.Security.Roles.RoleProvider.Instance()

and then i started using the properties of controller1. Do let me know if there is a flaw in that approach. Thanks a lot for all your help.

 
New Post
5/5/2008 12:36 PM
 

Try

Dim controller1 as New DotNetNuke.Security.Roles.RoleProvider

or

Dim controller1 as DotNetNuke.Security.Roles.RoleProvider = New DotNetNuke.Security.Roles.RoleProvider

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationGetUserRole MethodGetUserRole Method


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