scarlson 0 Newbie Poster

Does anyone know how to update or add a profile to HttpContext.Current.Profile? I am manually creating a user, adding him to a role and creating his profile. The problem is that the newly created profile is not in HttpContext.Current.Profile until I log in as the newly created user, which I do not want to do.

Here is a simple sample of what I am trying to do -

//Create the user
MembershipCreateStatus status = new MembershipCreateStatus();
MembershipUser membershipUser = Membership.CreateUser(userName, password, email, securityQuestion, securityAnswer, true, providerUserKey, out status);

//Add the user to the members role
membershipUser.IsApproved = true;
Membership.UpdateUser(membershipUser);
Roles.AddUserToRole(userName, "Member");

//Create the users profile
ProfileCommon p = (ProfileCommon)ProfileCommon.Create(userName, true);
p.FirstName = firstName;
p.Save();

//somewhere later in the code I need to get the
//current profile but this does not return the profile
ProfileProvider myProfile =
HttpContext.Current.Profile;


Thank you for your help