public override MembershipUser CreateUser( string username, string password, string email, string question, string answer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { if (string.IsNullOrEmpty(username)) username = email; status = MembershipCreateStatus.ProviderError; ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && GetUserNameByEmail(email) != "") { status = MembershipCreateStatus.DuplicateEmail; return null; } MembershipUser user = GetUser(username, false); if (user == null) { if (providerUserKey == null) { providerUserKey = Guid.NewGuid(); } else { if (!(providerUserKey is Guid)) { status = MembershipCreateStatus.InvalidProviderUserKey; return null; } } int subscriptionType = 0; if (HttpContext.Current.Session["subscriptiontype"] != null) subscriptionType = (int)HttpContext.Current.Session["subscriptiontype"]; using (Database db = new MySqlDatabase()) { if (db.RegisterUser( username, _applicationName, email, "", password, question, answer, subscriptionType) > 0) status = MembershipCreateStatus.Success; } return GetUser(username, false); } status = MembershipCreateStatus.DuplicateUserName; return null; }