Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes.

So, I decided to create my own custom membership provider. I only implemented the CreateUser method since that was the main thing I was looking for.

Here is the code for the CreateUser method in my custom membership provider:

public override MembershipUser CreateUser
string username, string password, string email,

 string passwordQuestion, string passwordAnswer, 

bool isApproved, object providerUserKey, out MembershipCreateStatus status)
bool result = false;

        MembershipUser user = 
MembershipUser(Name, username, providerUserKey,
            email, passwordQuestion, 
false, DateTime.Now, DateTime.Now,
            DateTime.Now, DateTime.Now, DateTime.Now);

        User newUser = 
new User(username, password, email);
        result = newUser.Save();

if (result)
            status = MembershipCreateStatus.Success;
return user;
            status = MembershipCreateStatus.ProviderError;
return null;

Anyway, this adds a new user into the database and works fine with the CreateUserWizard control. I thought if I implement the CreatingUser method of the CreateUserWizard control then I can call the Membership.CreateUser dynamically. Well, it does call the Membership.CreateUser method but it calls it twice. One call is made from the developer code which was intensional and other call is made internally by the CreateUserWizard control.

So, I concluded that its best to leave the CreateUserWizard control and not implement the CreatingUser method since by doing so it will insert duplicate data in the database. 

However if your control is not using a membership provider then you can do some additional and funcky stuff in Creating_User method.  

powered by IMHO 1.3

Posted on Thursday, February 23, 2006 10:34 AM | Back to top

Comments on this post: CreateUserWizard Control will file CreateUser internally!!

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Mohammad Azam | Powered by: