Question: Setting Profile for create new user

Discussion in 'ASP .Net' started by VB Programmer, Jan 16, 2006.

  1. 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.
     
    VB Programmer, Jan 16, 2006
    #1
    1. Advertising

  2. Any ideas folks?

    "VB Programmer" <> wrote in message
    news:...
    >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.
    >
     
    VB Programmer, Jan 17, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Qmhhc2thcg==?=
    Replies:
    1
    Views:
    557
    Bruce Barker
    Dec 10, 2005
  2. Brad
    Replies:
    1
    Views:
    1,161
    Roedy Green
    Jul 19, 2005
  3. Jeff
    Replies:
    2
    Views:
    496
  4. Andy B
    Replies:
    0
    Views:
    546
    Andy B
    May 3, 2008
  5. Steven
    Replies:
    5
    Views:
    504
    Steven
    Oct 24, 2008
Loading...

Share This Page