Reputation: 41
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
Upvotes: 1
Views: 2059
Reputation: 3657
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 */)
Upvotes: 1
Reputation: 32437
You have to create a subclass of the membership provider you use and provide an additional CreateUser
method that takes the parameters you require to create the user.
public class MyMembershipProvider : SqlMembershipProvider
{
public MembershipUser CreateUser(/* your custom arguments*/)
{
}
}
Create an extension method to invoke your method.
public static MembershipUser CreateUser(this Membership membership, /* your custom arguments*/)
{
((MyMembershipProvider)membership.Provider).CreateUser(/* your custom arguments*/);
}
Then you can use it as an orverload of the CreateUser
method.
Membership.CreateUser(/* your custom arguments*/);
Upvotes: 1