User can't login after creating them with the asp.net Create User Wizard
- by Xaisoft
When I create a user, they can't login until I go into the asp.net configuration and save them. I actually don't change any settings, I just press the save button and then they can login in. What I would like to do is to have the user be able to login once they are created, but I can't seem to get it to work. Here is my code for the CreatedUser method:
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
CustomerProfile adminProfile = CustomerProfile.GetProfile();
string username = ((TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).Text.Trim();
CustomerProfile createdUser = CustomerProfile.GetProfile(username);
createdUser.CustomerID = adminProfile.CustomerID;
createdUser.Save();
MembershipUser user = Membership.GetUser(username);
user.IsApproved = ((CheckBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("chkActivateUser")).Checked;
Roles.AddUserToRole(user.UserName, "nonadmin");
}