944,129 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2284
  • ASP.NET RSS
Jul 28th, 2006
0

Cannot load newly created profile

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
scarlson is offline Offline
1 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Resizing images from a SQL DataBase
Next Thread in ASP.NET Forum Timeline: How to add games to my site?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC