Problems adding values to Profile

Last post 09-04-2008 6:00 AM by dhayz2000. 2 replies.

Sort Posts:

  • Problems adding values to Profile

    09-03-2008, 11:43 AM
    • Member
      37 point Member
    • dhayz2000
    • Member since 05-23-2007, 10:32 AM
    • Ireland
    • Posts 21

    Hi there,

    I have a webform that adds new members and their role to a website.  I have some custom fields, which I have created in the Profile section of my web.config file as follows:

     

    <system.web>
     <profile>
       <providers>
       </providers>
       <properties>
         <add name="LocalAuthority" type="String" serializeAs="String" />
         <add name="Developer" type="String" serializeAs="String" />
         <add name="SalesAgent" type="String" serializeAs="String" />
       </properties>
     </profile>
    </system.web>
      

    However, when I am having trouble accessing and adding the Profile values in the code behind.  Intellisense does not allow me to chose Profile, which in turn means that I cannot access the custom values.  This is the code I am using:

      

    Membership.CreateUser(txtUsername.Text, txtPassword.Text, txtEmail.Text);
    
    // Add user to all selected roles from the roles listbox
    for (int i = 0; i < lbRoles.Items.Count; i++) {
        if (lbRoles.Items[i].Selected == true)
                Roles.AddUserToRole(txtUsername.Text, lbRoles.Items[i].Value);
    }
    
    // Add custom field data to Profile
    // This is where I am stuck - I can't get the Profile.Developer etc. to appear
     

    Any ideas where I am going wrong?

    Cheers,
    Darren
  • Re: Problems adding values to Profile

    09-03-2008, 2:57 PM
    Answer
    • All-Star
      17,440 point All-Star
    • guru_sarkar
    • Member since 08-30-2007, 8:00 PM
    • Posts 2,645
  • Re: Problems adding values to Profile

    09-04-2008, 6:00 AM
    • Member
      37 point Member
    • dhayz2000
    • Member since 05-23-2007, 10:32 AM
    • Ireland
    • Posts 21

     Hi Guru,

    Thanks for the link, that was indeed my problem.

    Cheers,
    Darren
Page 1 of 1 (3 items)