public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (string.IsNullOrEmpty(name)) { name = "SoftFluent.Samples.GEDMembershipProvider"; } if (string.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("MembershipProviderDescription", "SoftFluent.Samples.GED")); } base.Initialize(name, config); _enablePasswordRetrieval = ConvertUtilities.ToBoolean(config["enablePasswordRetrieval"], false); _enablePasswordReset = ConvertUtilities.ToBoolean(config["enablePasswordReset"], true); _requiresUniqueEmail = true; // cannot be changed here _requiresQuestionAndAnswer = ConvertUtilities.ToBoolean(config["requiresQuestionAndAnswer"], false); _updateLastActivity = ConvertUtilities.ToBoolean(config["updateLastActivity"], true); if (_requiresQuestionAndAnswer) { throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("UnsupportedRequiresQuestionAndAnswer", "Membership provider only supports requiresQuestionAndAnswer set to false.")); } _maxInvalidPasswordAttempts = ConvertUtilities.ToInt32(config["maxInvalidPasswordAttempts"], 5); _passwordAttemptWindow = ConvertUtilities.ToInt32(config["passwordAttemptWindow"], 10); _minRequiredPasswordLength = ConvertUtilities.ToInt32(config["minRequiredPasswordLength"], 4); _minRequiredNonAlphanumericCharacters = ConvertUtilities.ToInt32(config["minRequiredNonalphanumericCharacters"], 0); _passwordStrengthRegularExpression = ConvertUtilities.ToString(config["passwordStrengthRegularExpression"], "", true); if (_minRequiredNonAlphanumericCharacters > _minRequiredPasswordLength) { throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("MinNonAlphanMoreThanMinRequiredPassword", "MinRequiredNonalphanumericCharacters can not be more than MinRequiredPasswordLength.")); } _applicationName = config["applicationName"]; if (string.IsNullOrEmpty(_applicationName)) { _applicationName = applicationName; } _passwordFormat = (MembershipPasswordFormat)ConvertUtilities.ToEnum(config["passwordFormat"], MembershipPasswordFormat.Hashed); if ((_passwordFormat == MembershipPasswordFormat.Hashed) && (_enablePasswordRetrieval)) { throw new ProviderException(SoftFluent.Samples.GED.Resources.Manager.GetStringWithDefault("CannotRetrieveHash", "Membership provider can not retrieve hashed passwords.")); } config.Remove("enablePasswordRetrieval"); config.Remove("enablePasswordReset"); config.Remove("requiresQuestionAndAnswer"); config.Remove("applicationName"); config.Remove("requiresUniqueEmail"); config.Remove("maxInvalidPasswordAttempts"); config.Remove("passwordAttemptWindow"); config.Remove("passwordFormat"); config.Remove("name"); config.Remove("minRequiredPasswordLength"); config.Remove("minRequiredNonalphanumericCharacters"); config.Remove("passwordStrengthRegularExpression"); config.Remove("updateLastActivity"); }