Question: Setting Profile for create new user

V

VB Programmer

I am using personalization/profile to store info for the user that is not
contained in the aspnet_Users or aspnet_Membership tables. This info
includes, firstname, lastname, and phonenumber.

On my "signup" page I ask for all their info at one time, including
username, password, firstname, lastname, etc.... After I do a
Membership.CreateUser and Roles.AddUserToRole I want to store the profile
information. But, the code still thinks I'm 'Anynomous' when I get to the
profile part.

Here's a portion of the web.config....
<profile>
<properties>
<group name="PersonalInfo">
<add name="FirstName" />
<add name="LastName" />
<add name="PhoneNumber" />
</group >
</properties>
</profile>

Here's a portion of my code for the "Create User"...
Dim newUser As MembershipUser =
System.Web.Security.Membership.CreateUser(Me.txtUsername.Text,
Me.txtPassword.Text, _
Me.txtEmail.Text,
Me.txtSecurityAnswer.Text, _
Me.txtSecurityAnswer.Text,
False, status)

If newUser Is Nothing Then
Me.lblUserReject.Text = GetErrorMessage(status)
Exit Sub
Else
' put new user in member role
System.Web.Security.Roles.AddUserToRole(newUser.UserName.ToString,
"Member")

' user personalization
With Profile.PersonalInfo
.FirstName = Me.txtFirstName.Text
.LastName = Me.txtLastName.Text
.PhoneNumber = Me.txtMyPhone.Text
End With

Am I doing this correctly? Do I have the right idea? Any suggestions or
ideas?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top