我已經創建了自定義的MembershipUser,MembershipProvider和RolePrivoder類。除了一件事之外,這些工作都很有效,我對此感到非常滿意。我在「用戶」表中有一個額外的字段。我有一個重寫的CreateUser()方法,它接受額外的變量並將其放入數據庫中。C#asp.net自定義MembershipUser.createUser()方法,從createuserwizard控件調用它
我的問題是,我希望能夠從創建用戶嚮導控件調用這個。我已經定製了控件,讓它有一個下拉框來填充我的額外字段。我用下面的代碼來存儲一塊信息,但我在如何我要麼使用的配置文件或撥打我的自定義CREATEUSER方法茫然:
// Create an empty Profile for the newly created user
ProfileCommon p = (ProfileCommon)ProfileCommon.Create(CreateUserWizard1.UserName, true);
// Populate some Profile properties off of the create user wizard
p.CurrentLevel = Int32.Parse(((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("clevel")).SelectedValue);
// Save profile - must be done since we explicitly created it
p.Save();
謝謝你的任何和所有幫助
喬恩·霍金斯
+1 - 處理停用事件聽起來像一個真正hacky的解決方法。我不確定事件的具體內容,因爲我不確定它來自哪個類,但是正常情況下,這是一種UI功能,您應該根據成員資格提供者的行爲來進行後期處理 – 2009-01-28 16:56:44