| | |
Cannot load newly created profile
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2006
Posts: 1
Reputation:
Solved Threads: 0
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
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
- Applet load a class I have created (Java)
- Basic Windows Set-Up Problem? (Windows NT / 2000 / XP)
- Record Files (Pascal and Delphi)
- Open Gl Programing Error (help)... (Game Development)
- Help: damaged profile (Windows NT / 2000 / XP)
- login working in IE but not mozilla? (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Resizing images from a SQL DataBase
- Next Thread: Controls in GridView
Views: 1844 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list maps menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





