I have two sites in which I use a profile system. In one of the sites, the profile appears to work well, but in the other I get the error "Object reference not set to an instance of an object." This is the code:
protected void cuwReg_CreatedUser(object sender, EventArgs e)
{
CreateUserWizard cuw = (CreateUserWizard)FindControl("cuwReg");
//empty Profile for newly created user
ProfileCommon p = ProfileCommon.Create(cuw.UserName, true) as ProfileCommon;
p.Initialize(cuw.UserName.ToString(), true);
txt = Util.FindChild(cuw, "UserName") as TextBox;
p.UserName = txt.Text;
//populate Profile from controls
p.Phone = Util.FormatPhone((Util.FindChild(cuw, "txtPhone") as TextBox).Text.Trim());
p.Email = (Util.FindChild(cuw, "Email") as TextBox).Text.Trim();
p.FirstName = new System.Globalization.CultureInfo("en").TextInfo.ToTitleCase((Util.FindChild(cuw, " ...
Go to the complete details ...