我在我的項目中使用成員API與OpenId實現在我的項目構建於MVC2框架。 除了用戶名外,我還需要在註冊時與用戶關聯的其他字段。在aspnet_profile表中存儲額外的數據與會員資料數據
雖然我不確定,但我認爲asp.net中的Profile系統是爲這種類型的需求而構建的。另外,我還看到一張名爲'aspnet_profile'的其他成員表。
我在web.config中的應用添加以下啓用配置文件:
<profile enabled="true">
<properties>
<add name="FullName" allowAnonymous="false"/>
</properties>
</profile>
正如前面所說,應用程序需要一些額外的數據與用戶相關聯,採用會員API創建用戶,所以當我加的代碼幾行製作進入配置表
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");
}
但我沒有看到aspnet_profile表加入數據庫中的所有行。另外,我想問,如果這是默認的會員數據
非常有幫助,非常感謝! –