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

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Username problem while create DNN user programmaticallyUsername problem while create DNN user programmatically
Previous
 
Next
New Post
3/30/2016 5:28 AM
 

Hi Guys,

 I have write code for create DNN user programmatically by following code but it is inserting Username like this "50c5c87e-bba7-4fc8-b2b4-1d9e3e388dc5-contracthiring@outlook.com". It is something looks like merging GUID + EmailAddress. But it should be "li_ + FirstName + LastName" as I creating dynamically by following code.

I written Username log after & before  below line. It seems very strange thing. Below is my output.

            'Response.Write("objUserInfo Before: " & objUserInfo.Username)

            objUserCreateStatus = objMembershipProvider.CreateUser(objUserInfo)

            'Response.Write("objUserInfo: " & objUserInfo.Username)

 Output of Username:

 Before: li_Andrea Simon

After: 50c5c87e-bba7-4fc8-b2b4-1d9e3e388dc5-contracthiring@outlook.com

 

My Code:

                    Try
                        If MySettings("LinkedinUserNamePrefix") <> "" Then
                            fsUsername = MySettings("LinkedinUserNamePrefix") & objPerson.Firstname & " " & objPerson.Lastname
                        Else
                            fsUsername = objPerson.Firstname & " " & objPerson.Lastname
                        End If
                    Catch
                    End Try

             'Register user to the site
            Dim objUserInfo As New DotNetNuke.Entities.Users.UserInfo
            objUserInfo.PortalID = Me.PortalId
            objUserInfo.Username = fsUsername
            objUserInfo.FirstName = fName
            objUserInfo.LastName = lName
            objUserInfo.Email = EmailAdd
            objUserInfo.DisplayName = fsUsername
            objUserInfo.Membership.Username = fsUsername
            objUserInfo.Membership.Email = EmailAdd
            objUserInfo.Membership.Password = fsUsername

            ' User Profile
            objUserInfo.Profile.PreferredLocale = PortalSettings.DefaultLanguage
            objUserInfo.Profile.FirstName = fName
            objUserInfo.Profile.LastName = lName

            'Set Membership
            objUserInfo.Membership.Approved = True

            'Bind membership to user
            objUserInfo.IsSuperUser = False

            Dim objUserCreateStatus As UserCreateStatus = UserCreateStatus.AddUser
            Dim objMembershipProvider As DotNetNuke.Security.Membership.MembershipProvider = DotNetNuke.Security.Membership.MembershipProvider.Instance()
            'Response.Write("objUserInfo Before: " & objUserInfo.Username)
            objUserCreateStatus = objMembershipProvider.CreateUser(objUserInfo)
            'Response.Write("objUserInfo: " & objUserInfo.Username)

What is the problem in CreateUser method. Is it problem in DNN library.

I'm using DNN 07.04.00.


- Keval
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Username problem while create DNN user programmaticallyUsername problem while create DNN user programmatically


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