GetProviderElement() public method

public GetProviderElement ( string type ) : XmlElement
type string
return System.Xml.XmlElement
Exemplo n.º 1
0
    public override void Initialize(WebConfig wc)
    {
      base.Initialize(wc);

      values = defaults;

      XmlElement e = wc.GetProviderElement(sectionName);
      if (e == null) return;

      //GetOptionalParameter(e, "description");
      if (e.HasAttribute("enablePasswordRetrieval"))
        values.EnablePasswordRetrieval = Convert.ToBoolean(e.GetAttribute("enablePasswordRetrieval"));
      if (e.HasAttribute("enablePasswordReset"))
        values.EnablePasswordReset = Convert.ToBoolean(e.GetAttribute("enablePasswordReset"));
      if (e.HasAttribute("requiresQuestionAndAnswer"))
        values.RequiresQA = Convert.ToBoolean(e.GetAttribute("requiresQuestionAndAnswer"));
      if (e.HasAttribute("requiresUniqueEmail"))
        values.RequiresUniqueEmail = Convert.ToBoolean(e.GetAttribute("requiresUniqueEmail"));
      if (e.HasAttribute("passwordFormat"))
        values.PasswordFormat = (MembershipPasswordFormat)Enum.Parse(typeof(MembershipPasswordFormat), e.GetAttribute("passwordFormat"));
      if (e.HasAttribute("passwordStrengthRegularExpression"))
        values.PasswordStrengthRegEx = e.GetAttribute("passwordStrengthRegularExpression");
      if (e.HasAttribute("maxInvalidPasswordAttempts"))
        values.MaxInvalidPasswordAttempts = Convert.ToInt32(e.GetAttribute("maxInvalidPasswordAttempts"));
      if (e.HasAttribute("minRequiredPasswordLength"))
        values.MinRequiredPasswordLength = Convert.ToInt32(e.GetAttribute("minRequiredPasswordLength"));
      if (e.HasAttribute("minRequiredNonalphanumericCharacters"))
        values.MinRequiredNonAlphaNumericCharacters = Convert.ToInt32(e.GetAttribute("minRequiredNonalphanumericCharacters"));
      if (e.HasAttribute("passwordAttemptWindow"))
        values.PasswordAttemptWindow = Convert.ToInt32(e.GetAttribute("passwordAttemptWindow"));
    }
        public override void Initialize(WebConfig wc)
        {
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);
            if (e != null)
            {
                string mode = e.GetAttribute("mode");
                if (String.Compare(mode, "custom", true) == 0)
                    DefaultProvider = e.GetAttribute("customProvider");
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                if (e.HasAttribute("description"))
                    values.AppDescription = e.GetAttribute("description");
                if (e.HasAttribute("applicationName"))
                    values.AppName = e.GetAttribute("applicationName");
                if (e.HasAttribute("writeExceptionsToEventLog"))
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                if (e.HasAttribute("autogenerateschema"))
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null && 
                (DefaultProvider == values.ProviderName ||
                DefaultProvider == defaults.ProviderName);
        }
Exemplo n.º 3
0
        public override void Initialize(WebConfig wc)
        {
            base.Initialize(wc);

            values = defaults;

            XmlElement e = wc.GetProviderElement(sectionName);

            if (e == null)
            {
                return;
            }

            //GetOptionalParameter(e, "description");
            if (e.HasAttribute("enablePasswordRetrieval"))
            {
                values.EnablePasswordRetrieval = Convert.ToBoolean(e.GetAttribute("enablePasswordRetrieval"));
            }
            if (e.HasAttribute("enablePasswordReset"))
            {
                values.EnablePasswordReset = Convert.ToBoolean(e.GetAttribute("enablePasswordReset"));
            }
            if (e.HasAttribute("requiresQuestionAndAnswer"))
            {
                values.RequiresQA = Convert.ToBoolean(e.GetAttribute("requiresQuestionAndAnswer"));
            }
            if (e.HasAttribute("requiresUniqueEmail"))
            {
                values.RequiresUniqueEmail = Convert.ToBoolean(e.GetAttribute("requiresUniqueEmail"));
            }
            if (e.HasAttribute("passwordFormat"))
            {
                values.PasswordFormat = (MembershipPasswordFormat)Enum.Parse(typeof(MembershipPasswordFormat), e.GetAttribute("passwordFormat"));
            }
            if (e.HasAttribute("passwordStrengthRegularExpression"))
            {
                values.PasswordStrengthRegEx = e.GetAttribute("passwordStrengthRegularExpression");
            }
            if (e.HasAttribute("maxInvalidPasswordAttempts"))
            {
                values.MaxInvalidPasswordAttempts = Convert.ToInt32(e.GetAttribute("maxInvalidPasswordAttempts"));
            }
            if (e.HasAttribute("minRequiredPasswordLength"))
            {
                values.MinRequiredPasswordLength = Convert.ToInt32(e.GetAttribute("minRequiredPasswordLength"));
            }
            if (e.HasAttribute("minRequiredNonalphanumericCharacters"))
            {
                values.MinRequiredNonAlphaNumericCharacters = Convert.ToInt32(e.GetAttribute("minRequiredNonalphanumericCharacters"));
            }
            if (e.HasAttribute("passwordAttemptWindow"))
            {
                values.PasswordAttemptWindow = Convert.ToInt32(e.GetAttribute("passwordAttemptWindow"));
            }
        }
Exemplo n.º 4
0
        public override void Initialize(WebConfig wc)
        {
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                string mode = e.GetAttribute("mode");
                if (String.Compare(mode, "custom", true) == 0)
                {
                    DefaultProvider = e.GetAttribute("customProvider");
                }
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
                if (e.HasAttribute("enableExpireCallback"))
                {
                    values.EnableExpireCallback = GetBoolValue(e.GetAttribute("enableExpireCallback"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null &&
                                          (DefaultProvider == values.ProviderName ||
                                           DefaultProvider == defaults.ProviderName);
        }
Exemplo n.º 5
0
        public virtual void Initialize(WebConfig wc)
        {
            // first load up the defaults
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                DefaultProvider = e.GetAttribute("defaultProvider");
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null &&
                                          (DefaultProvider == values.ProviderName ||
                                           DefaultProvider == defaults.ProviderName);
        }
Exemplo n.º 6
0
        public virtual void Initialize(WebConfig wc)
        {
            // first load up the defaults
            GetDefaults();
            values = defaults;

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);
            if (e != null)
                DefaultProvider = e.GetAttribute("defaultProvider");

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                if (e.HasAttribute("description"))
                    values.AppDescription = e.GetAttribute("description");
                if (e.HasAttribute("applicationName"))
                    values.AppName = e.GetAttribute("applicationName");
                if (e.HasAttribute("writeExceptionsToEventLog"))
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                if (e.HasAttribute("autogenerateschema"))
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            Enabled = OriginallyEnabled = DefaultProvider != null && 
                (DefaultProvider == values.ProviderName ||
                DefaultProvider == defaults.ProviderName);
        }
Exemplo n.º 7
0
        public virtual void Initialize(WebConfig wc)
        {
            // first load up the defaults
            GetDefaults();
            values = defaults;
            if (string.IsNullOrEmpty(values.ProviderName))
            {
                NotInstalled = true;
            }

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                //OrininallyEnabled property should be true just when the current provider is already configured as default
                string currentProvider = e.GetAttribute("defaultProvider");
                if (!currentProvider.Equals(typeName, StringComparison.InvariantCultureIgnoreCase))
                {
                    DefaultProvider   = typeName;
                    OriginallyEnabled = false;
                }
                else
                {
                    DefaultProvider   = currentProvider;
                    OriginallyEnabled = true;
                }
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                //use the ProviderName configured just when is the current Provider, because this will cause conflicts when two providers are in the same section with a different name
                if (e.HasAttribute("name"))
                {
                    string providerName = e.GetAttribute("name");
                    values.ProviderName = !OriginallyEnabled ? typeName : providerName;
                }
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
                if (e.HasAttribute("enableExpireCallback"))
                {
                    values.EnableExpireCallback = GetBoolValue(e.GetAttribute("enableExpireCallback"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
            //enable the provider by default just when it was already configured as default
            Enabled = OriginallyEnabled;
            //Enabled = OriginallyEnabled = DefaultProvider != null && (DefaultProvider == values.ProviderName || DefaultProvider == defaults.ProviderName);
        }
Exemplo n.º 8
0
        public override void Initialize(WebConfig wc)
        {
            GetDefaults();
            values = defaults;
            if (string.IsNullOrEmpty(values.ProviderName))
            {
                NotInstalled = true;
            }


            //Personalization provider needs membership enabled
            XmlElement membership = wc.GetProviderSection("membership");

            if (membership == null || membership.Attributes["defaultProvider"] == null ||
                !membership.Attributes["defaultProvider"].Value.Equals("MySQLMembershipProvider", StringComparison.InvariantCultureIgnoreCase))
            {
                _membershipEnabled = false;
                return;
            }
            else
            {
                _membershipEnabled = true;
            }

            // get the default provider
            XmlElement e = wc.GetProviderSection(sectionName);

            if (e == null || e.FirstChild == null)
            {
                return;
            }

            var personalizationNode = e.FirstChild as XmlElement; // move to the <personalization> element

            if (personalizationNode == null || personalizationNode.FirstChild == null)
            {
                return;
            }

            string defaultProvider = personalizationNode.GetAttribute("defaultProvider");


            Enabled = OriginallyEnabled = defaultProvider != null &&
                                          (defaultProvider == values.ProviderName || defaultProvider == defaults.ProviderName);

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                values.ProviderName = e.GetAttribute("name");
                if (e.HasAttribute("connectionStringName"))
                {
                    values.ConnectionStringName = e.GetAttribute("connectionStringName");
                }
                if (e.HasAttribute("description"))
                {
                    values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    values.AppName = e.GetAttribute("applicationName");
                }
                if (e.HasAttribute("writeExceptionsToEventLog"))
                {
                    values.WriteExceptionToLog = GetBoolValue(e.GetAttribute("writeExceptionsToEventLog"), false);
                }
                if (e.HasAttribute("autogenerateschema"))
                {
                    values.AutoGenSchema = GetBoolValue(e.GetAttribute("autogenerateschema"), false);
                }
            }
            values.ConnectionString = wc.GetConnectionString(values.ConnectionStringName);
        }
Exemplo n.º 9
0
        public override void Initialize(WebConfig wc)
        {
            base.Initialize(wc);

            XmlElement e = wc.GetProviderSection(sectionName);

            if (e != null)
            {
                string currentProvider = e.GetAttribute("defaultProvider");
                if (!currentProvider.Equals(typeName, StringComparison.InvariantCultureIgnoreCase))
                {
                    base.DefaultProvider = typeName;
                    OriginallyEnabled    = false;
                }
                else
                {
                    base.DefaultProvider = currentProvider;
                    OriginallyEnabled    = true;
                }
            }

            e = wc.GetProviderElement(sectionName);
            if (e != null)
            {
                if (e.HasAttribute("name"))
                {
                    string providerName = e.GetAttribute("name");
                    base.values.ProviderName = !OriginallyEnabled ? typeName : providerName;
                }
                if (e.HasAttribute("connectionStringName"))
                {
                    string connStrName = e.GetAttribute("connectionStringName");
                    base.values.ConnectionStringName = !OriginallyEnabled ? "LocalMySqlServer" : connStrName;
                }
                if (e.HasAttribute("description"))
                {
                    base.values.AppDescription = e.GetAttribute("description");
                }
                if (e.HasAttribute("applicationName"))
                {
                    base.values.AppName = e.GetAttribute("applicationName");
                }
            }
            base.values.ConnectionString = wc.GetConnectionString(base.values.ConnectionStringName);

            NotInstalled = !_mySqlSimpleMembershipFound;

            Enabled = OriginallyEnabled;

            values = defaults;
            e      = wc.GetProviderElement(sectionName);
            if (e == null)
            {
                return;
            }

            if (e.HasAttribute("userTableName"))
            {
                values.UserTableName = e.GetAttribute("userTableName");
            }
            if (e.HasAttribute("userIdColumn"))
            {
                values.UserIdColumn = e.GetAttribute("userIdColumn");
            }
            if (e.HasAttribute("userNameColumn"))
            {
                values.UserNameColumn = e.GetAttribute("userNameColumn");
            }
            if (e.HasAttribute("autoGenerateTables"))
            {
                values.AutoGenerateTables = Convert.ToBoolean(e.GetAttribute("autoGenerateTables"));
            }
        }