GUID Inserting as Username while create DNN user programmatically
<p>I have write code for create DNN user programmatically by following code but it is inserting Username like this <code>50c5c87e-bba7-4fc8-b2b4-1d9e3e388dc5-contracthiring@outlook.com</code>. It is something looks like merging GUID + EmailAddress. But it should be <code>li_ + FirstName + LastName</code> as I creating dynamically by following code.</p>
<p>I written Username log after &amp; before  below line. It seems very strange thing. Below is my output.</p>
<pre><code>'Response.Write(&quot;objUserInfo Before: &quot; &amp; objUserInfo.Username)
objUserCreateStatus = objMembershipProvider.CreateUser(objUserInfo)
'Response.Write(&quot;objUserInfo: &quot; &amp; objUserInfo.Username) 
</code></pre>
<p>Output of Username:</p>
<blockquote>
<p>Before: li_Andrea Simon</p>
<p>After: 50c5c87e-bba7-4fc8-b2b4-1d9e3e388dc5-contracthiring@outlook.com</p>
</blockquote>
<p>My Code:</p>
<pre><code>Try
                    If MySettings(&quot;LinkedinUserNamePrefix&quot;) &lt;&gt; &quot;&quot; Then
                        fsUsername = MySettings(&quot;LinkedinUserNamePrefix&quot;) &amp; objPerson.Firstname &amp; &quot; &quot; &amp; objPerson.Lastname
                    Else
                        fsUsername = objPerson.Firstname &amp; &quot; &quot; &amp; 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(&quot;objUserInfo Before: &quot; &amp; objUserInfo.Username)
        objUserCreateStatus = objMembershipProvider.CreateUser(objUserInfo)
        'Response.Write(&quot;objUserInfo: &quot; &amp; objUserInfo.Username)
</code></pre>
<p>What is the problem in CreateUser method. Is it problem in DNN library.</p>
<p>I'm using DNN 07.04.00.</p>