DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Add Users using Vb.net

Sort:
You are not authorized to post a reply.
Page 1 of 212 > >>





New Around Here





    So i want to add users to dnn using a vb.net program and the dnn dll -  code is below - how do i make a connection to the site

    Imports DotNetNuke.Entities.Portals
    Imports DotNetNuke.Entities.Users
    Imports DotNetNuke.Common.Utilities
    Imports DotNetNuke.Security
    Public Class NewDnn
        Dim email As String
        Private Sub SetupNewUser()
            Dim portalSettings As New PortalSettings
            portalSettings.PortalId =
            Dim portalSettings = portalSettings.Current
            Dim Membership = New UserMembership()
            Dim user = New UserInfo
            With user
                .Username = "[email protected],"
                .DisplayName = "Example Display Name"
                .Email = email
                .FirstName = "First Name"
                .LastName = "Last Name"
                .IsSuperUser = False
                .PortalID = portalSettings.PortalId
                .Membership.Password = "securedpassword"
            End With

            Dim status = UserController.CreateUser(user)
            '// this creates the user And/Or gives you a status code to act upon

            '  var status = UserController.CreateUser(ref user);
        End Sub
    End Class






    Veteran Member





      It probably would be best to create a module or a web service to do this.
      Joe Craig
      DNN MVP
      Patapsco Research Group





      New Around Here





        Joe, are you saying that a vb.net program cannot connect to the web site and update users?

        I have the dll referenced in my vb.net program and just need to know how to connect to web site to do an update, i understand that i have to be carefull regarding updating the data base and all of that. Where would i be able to find the code to connect to web site portol so i can execute an add user subroutine.

        Thanks,

        Bob






        Veteran Member





          Bob,

          of course you can write a VB program to add users to the database, but the problem would be that the users will be in the database but not appear on the web site (because the web site reads that from the cache), and you have to do a lot of things manually that are necessary and that are done by the API - e.g. assign a user to the portal and to the system roles etc.. And when the internal logic of the DNN core is changing you may screw up your site completetly, so this is not a recommended practice.

          You should write a DNN module in VB (that is possible) or C#, and integrate that on your web site, or write a web service that is contacted by your VB or C# or whatever program to add users. In both cases you can use the (public) API, and don't have to care about cache etc.

          Happy DNNing!
          Michael

           

          Michael Tobisch
          DNN★MVP

          dnnWerk Austria
          DNN Connect





          New Around Here





            Michael, Want to do it the right way just started  DNN 60 days ago. Where do i find the public API at?

            So i have a group of golfers that have access to another site which allows them to sign up for events, They have a userid and password for that site and i want to automatically set them up as a user with the same userid and password on my dnn web site.

            I would think that what i am trying to accomblish has been done many times, do you know of any module or place that may have done this.

            I am new to dnn and this is the first web site i ever put together, just an old fashion vb.net programmer.

            Can you point me in direction to learn about modules along with public api samples.

            www.temeculacreekmensgolfclub.com

            Thanks,

            Bob

             






            Veteran Member





              If you want to connect an external program to a DNN site, you don't need a module (as those run inside of DNN). Instead, the "right" way to do this is to create a webservice at the DNN side, and then add code to your external program/site to connect to DNN and create the users. Then, users can login to the the DNN site.

              A good set of tutorials is available at DNNHero.com. Start with https://www.dnnhero.com/c...video-tutorials-2018 and look for the videos that deal with headless DNN. You probably want to pay attention to the DNN side and the creation of the webservice.

              For that part, you might also want to take a look at "DNN API Endpoint," a module from dnnsharp.com. It is a commercial module, but it will save you a ton of work. I also think that there are some webservice tutorials at DNNHero from Scott Wilkinson.

              As for your program/website, all you need to do is write the code to communicate with the webservice.
              Joe Craig
              DNN MVP
              Patapsco Research Group





              New Around Here





                Joe, Thanks for all that input let me start looking into it all....

                 






                Veteran Member





                  I should also have said that there MUST be user management APIs associated with the user management part of the Persona Bar. I say this because the Persona Bar is based on webservices.

                  So, hopefully someone who knows these things can chime in and educate us. (Maybe start by looking at the PB's User module?)
                  Joe Craig
                  DNN MVP
                  Patapsco Research Group





                  New Around Here





                    Posted By Bob M on 09 Apr 2020 12:50 PM

                    Michael, Want to do it the right way just started  DNN 60 days ago. Where do i find the public API at?

                    So i have a group of golfers that have access to another site which allows them to sign up for events, They have a userid and password for that site and i want to automatically set them up as a user with the same userid and password on my dnn web site.

                    I would think that what i am trying to accomblish has been done many times, do you know of any module or place that may have done this.

                    I am new to dnn and this is the first web site i ever put together, just an old fashion vb.net programmer.

                    Can you point me in direction to learn about modules along with public api samples.

                    www.temeculacreekmensgolfclub.com

                    Thanks,

                    Bob

                     

                     

                    Hi Bob, I would like to give you some help with this. Are you looking for a way to have single signon across your DNN instance and the golf website?

                    If you only require a one off migration of the users to DNN then your VB code can be implemented in a step to move the accounts across. However, you will not be able to sync the password changes unless you create a link between the two systems via webservices or an API. Hope this helps.

                     






                    New Around Here





                      Michael, thanks for following up. So all golfers in our club have a ghin number which is assigned to them to keep a golf handicap. So that is the unique identifier or each user. So i am not concerned about a single sign in process with the two sites. Want to establish the username  in dnn system using the ghin number. Then i can use it in the future to link to a page i plan on having called "My.." which would have sub pages with my scores, my handicap index history, my winnings, etc. by using the [User:Username]  

                      When we get a new member i want to use my vb.net application to write out a new username to the dnn system.

                      Thanks,

                      Bob

                       

                      You are not authorized to post a reply.
                      Page 1 of 212 > >>

                      These Forums are dedicated to the discussion of DNN Platform.

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

                      1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
                      2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
                      3. 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.
                      4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                      5. No Flaming or Trolling.
                      6. No Profanity, Racism, or Prejudice.
                      7. Site Moderators have the final word on approving / removing a thread or post or comment.
                      8. English language posting only, please.

                      Would you like to help us?

                      Awesome! Simply post in the forums using the link below and we'll get you started.

                      Get Involved