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.0Problems creating a new user from codeProblems creating a new user from code
Previous
 
Next
New Post
3/15/2009 7:53 PM
 

Please Help. I am trying to add a new user from code and always getting this message instead of just adding a new user:

Authenticated
You have been successfully authenticated. However, this authenticated Identity is not a member of this site. You can either associate the Identity with an existing user (by providing the username and password) or you can register as a new member.
 

DNN

Dim oUser As UserInfo = New DotNetNuke.Entities.Users.UserInfo
            oUser.PortalID = 0
            oUser.IsSuperUser = False
            oUser.FirstName = strFirstName
            oUser.LastName = strLastName
            oUser.Email = strEmailAddress
            oUser.Username = strEmailAddress
            oUser.DisplayName = strFirstName        
            oUser.Profile.FirstName = strFirstName
            oUser.Profile.LastName = strLastName
            oUser.Profile.City = ProfileCity
            oUser.Profile.Street = ProfileStreet
            oUser.Profile.Region = ProfileRegion
            oUser.Profile.Telephone = ProfileTelephone
            oUser.Profile.PostalCode = ProfilePostalCode
            Dim oNewMembership As UserMembership = New UserMembership
            oNewMembership.CreatedDate = System.DateTime.Now
            oNewMembership.Email = oUser.Email
            oNewMembership.IsOnLine = False
            oNewMembership.Username = oUser.Username
            oNewMembership.Password = strPassword
            oUser.Membership = oNewMembership

            UserCreateStatus.Success.Equals(UserController.CreateUser(oUser))

 

 

 
New Post
3/16/2009 12:57 AM
Accepted Answer 

hmm try this:

            Dim oUserInfo As New UserInfo()
            oUserInfo.PortalID = PortalID
            oUserInfo.Membership.Username = NewUsername
            oUserInfo.Username = NewUsername
            oUserInfo.FirstName = FirstName
            oUserInfo.LastName = LastName
            oUserInfo.DisplayName = DisplayName
            oUserInfo.Membership.Email = email
            oUserInfo.Email = email
            oUserInfo.Membership.Approved = True
            oUserInfo.AffiliateID = Null.NullInteger
            oUserInfo.Membership.Password = Newpassword

            Dim objUserCreateStatus As Security.Membership.UserCreateStatus = UserController.CreateUser(oUserInfo)

 

see:

http://iweb.codeplex.com/SourceControl/changeset/view/12386#6339

and

http://iweb.codeplex.com/SourceControl/changeset/view/12386#6336



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problems creating a new user from codeProblems creating a new user from code


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