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.0BC30469: Reference to a non-shared member requires an object referenceBC30469: Reference to a non-shared member requires an object reference
Previous
 
Next
New Post
8/8/2008 9:18 AM
 

When I add:

If RoleExists(Role1) = False Then
                CreateRole(Role1)
            End If

to my custom module .vb page I get the error:

DotNetNuke.Services.Exceptions.ModuleLoadException: F:\.....\........\.......\DesktopModules\PGT\ViewPGT.ascx.vb(506): error BC30469: Reference to a non-shared member requires an object reference. ---> System.Web.HttpCompileException: F:\.....\........\.......\DesktopModules\PGT\ViewPGT.ascx.vb(506): error BC30469: Reference to a non-shared member requires an object reference. at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

 
New Post
8/8/2008 12:05 PM
 

What's at line 506 of \DesktopModules\PGT\ViewPGT.ascx.vb?

Hope I can help,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
8/9/2008 6:49 AM
 

Thank you Brian. I did notice in the error message, where the error is comming from. I simply dont understand why I am getting an error when I add that line of code. I have been working on this for 2 weeks and searching everywhere and I cannot figure out how to get CreateRole to work in DNN. Can you please help further?

 
New Post
8/11/2008 10:31 AM
 

So, you're saying that your call to CreateRole is line 506?  Is CreateRole your own method, or is it DotNetNuke.Security.Roles.RoleProvider.CreateRole?  You could try RoleProvider.Instance().CreateRole(...) instead (with a Using DotNetNuke.Security.Roles directive at the top of your file).

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
8/12/2008 1:01 PM
 

Thank you again Brian.

Sorry about the last post, I did not notice you were ASKING if CreateRole is on line 506 but that is correct.

I tried RoleProvider.Instance().CreateRole(RoleName) but then I get the error: "RoleProvider' is ambiguous, imported from the namespaces or types 'DotNetNuke.Security.Roles, System.Web.Security'."

I dont know if CreateRole is a proper "Method" or not? Really I dont know much at all about Role providers etc. I am really needing to get this working in a hurry and am just relieing on what info I can find using google.

This is what I am currently trying to get to work but with errors also. I found this code sample on another page and am trying to get it to fit my needs. Can you tell me either how to get it to work or if there is a totally different way to do what I am needing to do. My ultimate goal is to be able to have a small module for admins where I can input a users name in a textbox then on button click, the code create's 1 role and assignes the user to that role & creates a couple other role that go along with it. The bult of the code I can handle no problem, I just cannot get it to dynamically create the roles. Also, how do I get it to set the price and term period along with the role?

Current code:

            Dim UserName1 As String
            Dim RoleName1 As String
            UserName1 = (selectedRole & "2")
            RoleName1 = (Role1 & selectedWeek)
            Dim objRoleController As DotNetNuke.Security.Roles.RoleController
            objRoleController = New DotNetNuke.Security.Roles.RoleController
            Dim userId As Integer = UserController.GetUserByName(0, UserName1)
            Dim objRoles As New RoleController
            Dim roleId As Integer = objRoles.GetRoleByName(PortalSettings.PortalId, RoleName1)
            objRoleController.AddUserRole(PortalSettings.PortalId, userId, roleId, Null.NullDate, Null.NullDate)
Errors:

Value of type 'DotNetNuke.Entities.Users.UserInfo' cannot be converted to 'Integer'. 
Value of type 'DotNetNuke.Security.Roles.RoleInfo' cannot be converted to 'Integer'.  

The code is getting the username and the target role name from text boxes. How can I find out the UserId & RoleId from the UserName & RoleName?

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0BC30469: Reference to a non-shared member requires an object referenceBC30469: Reference to a non-shared member requires an object reference


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