I am using Membership API with OpenId implementation in my project built on MVC2 framework. Other than the username , I need some other fields to be associated with the user at the time of registration.
I am not sure though but I think Profile system in asp.net is built for this type of requirement. Also, I see a table with other membership tables named 'aspnet_profile'.
I added following settings in the application web.config to enable the profile :
<profile enabled="true">
<properties>
<add name="FullName" allowAnonymous="false"/>
</properties>
</profile>
As said before, application need some additional data to be associated with the user, so when creating a user using Membership API, I added few more lines of code for making entry into profile table
System.Web.Security.MembershipCreateStatus status = MembershipService.CreateUser(userModel.UserName, userModel.Password, userModel.UserName);
if (status == System.Web.Security.MembershipCreateStatus.Success)
{
FormsService.SignIn(userModel.UserName, true);
Session["Username"] = userModel.UserName;
dynamic profile = ProfileBase.Create(MembershipService.GetUser(userModel.UserName).UserName);
profile.FullName = userModel.UserFullName;
profile.Save();
RedirectToAction("Tech", "Home");
}
But I don't see any line added in the aspnet_profile table in the database. Also, I wanted to ask if this is the preferred way of adding additional data along with default membership data
I made it work by making some changes related to default profile provider name in the web.config:
Also I added one more line between call to ProfileBase.Create function and setting the Profile.FullName;
I finally saw an entry in the aspnet_profile table for the newly registered user :)