Cannot load newly created profile

Reply

Join Date: Jul 2006
Posts: 1
Reputation: scarlson is an unknown quantity at this point 
Solved Threads: 0
scarlson scarlson is offline Offline
Newbie Poster

Cannot load newly created profile

 
0
  #1
Jul 28th, 2006
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum


Views: 1844 | Replies: 0
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC