Membership & Profile Question

G

Guest

I have this block of code below, but when ran it only creates the member it
doesnt fill in his profile data. Is there something I am missing? Please let
me know what I can do, just trying to progamatically create a member and fill
in his profile information. Thanks in advance.

protected void btnCreateuser_Click(object sender, EventArgs e)
{
// Store username for use
string strNewUsername = tbUserName.Text;

MembershipCreateStatus mcs = new MembershipCreateStatus();

// Create User Account
Membership.CreateUser(tbUserName.Text, tbPassword.Text,
tbEmail.Text, "What year was this application built?", "2006", true, out mcs);
Roles.AddUserToRole(strNewUsername, "user");
lblStatus.Text = mcs.ToString();

// Acces & fill new members profile with information
MembershipUser muNewUser = Membership.GetUser(strNewUsername);
ProfileCommon pcNewUser =
(ProfileCommon)ProfileBase.Create(muNewUser.UserName, true);
pcNewUser.Address1 = tbAddress.Text;
pcNewUser.Address2 = tbAddress2.Text;
pcNewUser.City = tbCity.Text;
pcNewUser.Name = tbName.Text;
pcNewUser.PhoneCell = tbCellPhone.Text;
pcNewUser.PhoneHome = tbHomePhone.Text;
pcNewUser.PhoneOffice = tbOfficePhone.Text;
pcNewUser.SponsorCode = Profile.UserName;
pcNewUser.SponsorCodeLevel2 = Profile.SponsorCode;
pcNewUser.State = tbState.Text;
pcNewUser.Zip = Int32.Parse(tbZip.Text);
}
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top