本文介绍了如何将参数添加到Membership.CreateUser()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  CREATEUSER(用户名字符串,字符串密码,串电子邮件,
串passwordQuestion,串passwordAnswer,布尔isApproved,
对象providerUserKey,出MembershipCreateStatus地位);
Membership.CreateUser(TextBox1.Text,TextBox2.Text,TextBox3.Text,
TextBox4.Text,TextBox5.Text,真实,出结果);

我可以覆盖 CREATEUSER()函数添加额外的参数,年龄,地址和存储这些数据转换成我在成员关系表加入ASPNETDB


解决方案

在参考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 */)

这篇关于如何将参数添加到Membership.CreateUser()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 15:34