且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将参数添加到Membership.CreateUser()

更新时间:2023-11-30 19:43:52

在参考Eranga的建议:

此将不工作,静态类型不能被用作参数。据我知道你不能覆盖 CREATEUSER 方法,而无需编写自定义的供应商,然后用您自己的参数创建一个公共CREATEUSER方法,那么铸造供应商打电话给你的方法像这样:

 ((MyMembershipProvider)Membership.Provider).CreateUser(/ *我的参数* /)

CreateUser (string username, string password, string email,
string passwordQuestion, string passwordAnswer, bool isApproved,
object providerUserKey, out MembershipCreateStatus status );


Membership.CreateUser (TextBox1.Text, TextBox2.Text, TextBox3.Text, 
TextBox4.Text, TextBox5.Text, true, out result);

Can i override CreateUser() Function to add extra parameters as age and address and store these data into the corresponing Columns that i added in Membership Table in ASPNETDB

In reference to Eranga's suggestion:

This will not work, static types cannot be used as parameters. As far as I know you cannot override the CreateUser method without writing your own custom provider, then creating a public CreateUser method with your own parameters, then casting the provider to call your method like so:

((MyMembershipProvider)Membership.Provider).CreateUser(/* my parameters */)