Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sean 141 posts 179 karma points
    Mar 29, 2011 @ 13:31
    Sean
    0

    Error creating a new user

    Hi There,

    I was wondering if somone could help me with this error that I'm getting. It's No member with username 'xxxxxxx' exists.

    I'm wanting to create a new member and save them, so I would expect that the provider would return this message given that I want all usernames to be unique.

    How can I get this status as a message and then process the new member accordingly or am I just doind it wrong.

    Thanks in advance.

    Sean

     

         
    //member class
            public static MemberProfile GetUserProfile()
            {
                return Create(Membership.GetUser().UserName) as MemberProfile;
            }

           
    //snippet from the OnCreatingUser event
    myproject.Members.MemberProfile mp = myproject.Members.MemberProfile.GetUserProfile(strUserName);
                            if (mp != null)
                            {
                                mp.AuthGuid = newUserGuid;
                                mp.secretQuestion = ((DropDownList)cuw.CreateUserStep.ContentTemplateContainer.FindControl("Question")).Text;
                                mp.secretAnswer = ((TextBox)cuw.CreateUserStep.ContentTemplateContainer.FindControl("Answer")).Text;
                                mp.isLocked = true;
                                mp.isApproved = false;
                                mp.Save();

                                Roles.AddUserToRole(strUserName, "Retail");
    }

Please Sign in or register to post replies

Write your reply to:

Draft