I have created a class to handle membership user creation with custom fields.
I have done it based on this solutions:
- How to assign Profile values?
-
namespace CCL { public static MemberProfile CurrentUser { get { if (Membership.GetUser() != null) return ProfileBase.Create(Membership.GetUser().UserName) as MemberProfile; else return null; } } }
And now I'm trying to use create the user and get the profile data:
if (Membership.GetUserNameByEmail(email) == null)
{
MembershipUser member = Membership.CreateUser(username, password, email);
Roles.AddUserToRole(username, "WebsiteUsers");
CCL.MemberProfile currentProfile = CCL.MemberProfile.CurrentUser;
bool exists = currentProfile != null;
Response.Write(exists.ToString());
}
but currentProfile is returning null.
So I'm unable to assign values from the form to my member custom properties which are handled by the properties set in the class :(
I don't get how I can make it working :(
Does anyone have some thoughts? Thanks