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.