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
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
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 TobischDNN★MVP
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
Joe, Thanks for all that input let me start looking into it all....
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.
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.
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:
Awesome! Simply post in the forums using the link below and we'll get you started.