Hi there!
I made a Custom Membership Provider, with a custom CreateUser method that accepts one more argument, like this:
public class CustomMembershipProvider : MembershipProvider
{
// code
public override MembershipUser CreateUser(string username,
string password, etc...)
{
// does nothing
}
public MembershipUser MyCreateUser(string username,string password,string COMPANY, etc...)
{
// validades the fields and inserts the user in the db
}
}
And now i want to use the Create User Wizard control to insert users, with that extra field. I have extended the control to something like this:
public class CustomCreateUser : CreateUserWizard
{
public CustomCreateUser(): base()
{
}
protected override void OnCreatingUser(LoginCancelEventArgs e)
{
MembershipUser newUser = ((CustomMembershipProvider)Membership.Provider).MyCreateUser(username,password,company, etc...)
}
}
The problem is that after this OnCreatingUser is called, the control calls the provider's default CreateUser (the one that does nothing) method internally, throwing an error because the user was already inserted...
Its possible to prevent the second call, by overriding a method in the CustomCreateUser?
Thanks in advance