///<summary> /// /// Adds a new membership user to the data source. /// ///</summary> /// ///<returns> /// /// A <see cref="T:System.Web.Security.MembershipUser" /> object populated with the information for the newly created user. /// ///</returns> /// ///<param name="username"> /// The user name for the new user. /// </param> ///<param name="password"> /// The password for the new user. /// </param> ///<param name="email"> /// The e-mail address for the new user. /// </param> ///<param name="passwordQuestion"> /// The password question for the new user. /// </param> ///<param name="passwordAnswer"> /// The password answer for the new user /// </param> ///<param name="isApproved"> /// Whether or not the new user is approved to be validated. /// </param> ///<param name="providerUserKey"> /// The unique identifier from the membership data source for the user. /// </param> ///<param name="status"> /// A <see cref="T:System.Web.Security.MembershipCreateStatus" /> enumeration value indicating whether the user was created successfully. /// </param> public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { var args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && GetUserNameByEmail(email) != null) { status = MembershipCreateStatus.DuplicateEmail; return null; } MembershipUser u = GetUser(username, false); if (u == null) { var member = new Member(username, EncodePassword(password), email, passwordQuestion, passwordAnswer, isApproved); this.members.Add(member); if (providerUserKey != null) { if (!(providerUserKey is Guid)) { status = MembershipCreateStatus.InvalidProviderUserKey; return null; } member.ID = (Guid) providerUserKey; } status = MembershipCreateStatus.Success; return member.ToMembershipUser(); } status = MembershipCreateStatus.DuplicateUserName; return null; }