public override SystemWeb.MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out SystemWeb.MembershipCreateStatus status) { SystemWeb.ValidatePasswordEventArgs args = new SystemWeb.ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = SystemWeb.MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && !string.IsNullOrEmpty(GetUserNameByEmail(email))) { status = SystemWeb.MembershipCreateStatus.DuplicateEmail; return null; } if (QryFetchUserByName.QueryCount(username, Application.ID).UniqueResult<int>() > 0) { status = SystemWeb.MembershipCreateStatus.DuplicateUserName; } else { Membership user = new Membership(); user.UserName = username; user.IsAnonymous = false; user.Application = Application; user.Password = EncodePassword(password, machineKey.ValidationKey); user.PasswordFormat = (int)PasswordFormat; user.PasswordSalt = machineKey.ValidationKey; user.Email = email; user.PasswordQuestion = passwordQuestion; user.PasswordAnswer = EncodePassword(passwordAnswer, machineKey.ValidationKey); user.IsApproved = isApproved; user.CreateDate = DateTime.Now; try { user.Save(); UnitOfWork.CurrentSession.Flush(); status = SystemWeb.MembershipCreateStatus.Success; } catch (Exception ex) { throw new ProviderException("Failed to create user", ex); } return GetUser(username, false); } return null; }