Exemple #1
0
        private List<ConfigurationException>    _errors;                // errors

        // constructor used for Clone()
        FactoryRecord(
                string              configKey,
                string              group,
                string              name,
                object              factory,
                string              factoryTypeName,
                SimpleBitVector32   flags,
                ConfigurationAllowDefinition    allowDefinition,
                ConfigurationAllowExeDefinition allowExeDefinition,
                OverrideModeSetting             overrideModeDefault,
                string              filename,
                int                 lineNumber,
                ICollection<ConfigurationException> errors) {

            _configKey              = configKey;
            _group                  = group;
            _name                   = name;
            _factory                = factory;
            _factoryTypeName        = factoryTypeName;
            _flags                  = flags;
            _allowDefinition        = allowDefinition;
            _allowExeDefinition     = allowExeDefinition;
            _overrideModeDefault    = overrideModeDefault;
            _filename               = filename;
            _lineNumber             = lineNumber;

            AddErrors(errors);
        }
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            string str;

            switch (allowExeDefinition)
            {
            case ConfigurationAllowExeDefinition.MachineToRoamingUser:
                str = "MACHINE/EXE/ROAMING_USER";
                break;

            case ConfigurationAllowExeDefinition.MachineToLocalUser:
                return(true);

            case ConfigurationAllowExeDefinition.MachineOnly:
                str = "MACHINE";
                break;

            case ConfigurationAllowExeDefinition.MachineToApplication:
                str = "MACHINE/EXE";
                break;

            default:
                throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::IsDefinitionAllowed");
            }
            return(configPath.Length <= str.Length);
        }
        public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition,
                                                     ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
        {
            if (!IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
            {
                switch (allowExeDefinition)
                {
                case ConfigurationAllowExeDefinition.MachineOnly:
                    throw new ConfigurationErrorsException(
                              SR.Config_allow_exedefinition_error_machine, errorInfo);

                case ConfigurationAllowExeDefinition.MachineToApplication:
                    throw new ConfigurationErrorsException(
                              SR.Config_allow_exedefinition_error_application, errorInfo);

                case ConfigurationAllowExeDefinition.MachineToRoamingUser:
                    throw new ConfigurationErrorsException(
                              SR.Config_allow_exedefinition_error_roaminguser, errorInfo);

                default:
                    // If we have extended ConfigurationAllowExeDefinition
                    // make sure to update this switch accordingly
                    throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::VerifyDefinitionAllowed");
                }
            }
        }
Exemple #4
0
        // constructor used for a section
        internal FactoryRecord(
                string configKey,
                string group,
                string name,
                string factoryTypeName,
                bool allowLocation,
                ConfigurationAllowDefinition allowDefinition,
                ConfigurationAllowExeDefinition allowExeDefinition,
                OverrideModeSetting             overrideModeDefault,
                bool restartOnExternalChanges,
                bool requirePermission,
                bool isFromTrustedConfigRecord,
                bool isUndeclared,
                string filename,
                int lineNumber) {

            _configKey                  = configKey;
            _group                      = group;
            _name                       = name;
            _factoryTypeName            = factoryTypeName;
            _allowDefinition            = allowDefinition;
            _allowExeDefinition         = allowExeDefinition;
            _overrideModeDefault        = overrideModeDefault;
            AllowLocation               = allowLocation;
            RestartOnExternalChanges    = restartOnExternalChanges;
            RequirePermission           = requirePermission;
            IsFromTrustedConfigRecord   = isFromTrustedConfigRecord;
            IsUndeclared                = isUndeclared;
            _filename                   = filename;
            _lineNumber                 = lineNumber;
        }
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition,
                                                 ConfigurationAllowExeDefinition allowExeDefinition)
        {
            string allowedConfigPath;

            switch (allowExeDefinition)
            {
            case ConfigurationAllowExeDefinition.MachineOnly:
                allowedConfigPath = MachineConfigPath;
                break;

            case ConfigurationAllowExeDefinition.MachineToApplication:
                allowedConfigPath = ExeConfigPath;
                break;

            case ConfigurationAllowExeDefinition.MachineToRoamingUser:
                allowedConfigPath = RoamingUserConfigPath;
                break;

            // MachineToLocalUser does not current have any definition restrictions
            case ConfigurationAllowExeDefinition.MachineToLocalUser:
                return(true);

            default:
                // If we have extended ConfigurationAllowExeDefinition
                // make sure to update this switch accordingly
                throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::IsDefinitionAllowed");
            }

            return(configPath.Length <= allowedConfigPath.Length);
        }
Exemple #6
0
 public virtual void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     if (!IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
     {
         throw new ConfigurationErrorsException("The section can't be defined in this file (the allowed definition context is '" + allowDefinition + "').", errorInfo.Filename, errorInfo.LineNumber);
     }
 }
 // constructor used for a section
 internal FactoryRecord(
         string configKey,
         string group,
         string name,
         string factoryTypeName,
         bool allowLocation,
         ConfigurationAllowDefinition allowDefinition,
         ConfigurationAllowExeDefinition allowExeDefinition,
         OverrideModeSetting             overrideModeDefault,
         bool restartOnExternalChanges,
         bool requirePermission,
         bool isFromTrustedConfigRecord,
         bool isUndeclared,
         string filename,
         int lineNumber)
 {
     _configKey                  = configKey;
     _group                      = group;
     _name                       = name;
     _factoryTypeName            = factoryTypeName;
     _allowDefinition            = allowDefinition;
     _allowExeDefinition         = allowExeDefinition;
     _overrideModeDefault        = overrideModeDefault;
     AllowLocation               = allowLocation;
     RestartOnExternalChanges    = restartOnExternalChanges;
     RequirePermission           = requirePermission;
     IsFromTrustedConfigRecord   = isFromTrustedConfigRecord;
     IsUndeclared                = isUndeclared;
     _filename                   = filename;
     _lineNumber                 = lineNumber;
 }
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            switch (allowDefinition)
            {
            case ConfigurationAllowDefinition.MachineOnly:
                return(configPath.Length <= MachineConfigPath.Length);

            case ConfigurationAllowDefinition.MachineToWebRoot:
                return(configPath.Length <= RootWebConfigPath.Length);

            case ConfigurationAllowDefinition.MachineToApplication:
                // In some scenarios the host does not have an application path.
                // Allow all definitions in this case.
                return(String.IsNullOrEmpty(_appConfigPath) ||
                       (configPath.Length <= _appConfigPath.Length) ||
                       IsApplication(configPath));

            // MachineToLocalUser does not current have any definition restrictions
            case ConfigurationAllowDefinition.Everywhere:
                return(true);

            default:
                // If we have extended ConfigurationAllowDefinition
                // make sure to update this switch accordingly
                throw ExceptionUtil.UnexpectedError("WebConfigurationHost::IsDefinitionAllowed");
            }
        }
 internal SectionInformation()
 {
     allow_definition            = ConfigurationAllowDefinition.Everywhere;
     allow_location              = true;
     allow_override              = true;
     inherit_on_child_apps       = true;
     restart_on_external_changes = true;
 }
Exemple #10
0
		internal SectionInformation ()
		{
			allow_definition = ConfigurationAllowDefinition.Everywhere;
			allow_location = true;
			allow_override = true;
			inherit_on_child_apps = true;
			restart_on_external_changes = true;
		}
Exemple #11
0
        internal void SetRuntimeConfigurationInformation(BaseConfigurationRecord configRecord,
                                                         FactoryRecord factoryRecord, SectionRecord sectionRecord)
        {
            _flags[FlagAttached] = true;

            // factory info
            ConfigKey                            = factoryRecord.ConfigKey;
            Name                                 = factoryRecord.Name;
            _typeName                            = factoryRecord.FactoryTypeName;
            _allowDefinition                     = factoryRecord.AllowDefinition;
            _allowExeDefinition                  = factoryRecord.AllowExeDefinition;
            _flags[FlagAllowLocation]            = factoryRecord.AllowLocation;
            _flags[FlagRestartOnExternalChanges] = factoryRecord.RestartOnExternalChanges;
            _flags[FlagRequirePermission]        = factoryRecord.RequirePermission;
            _overrideModeDefault                 = factoryRecord.OverrideModeDefault;

            if (factoryRecord.IsUndeclared)
            {
                _flags[FlagIsUndeclared]        = true;
                _flags[FlagDeclared]            = false;
                _flags[FlagDeclarationRequired] = false;
            }
            else
            {
                _flags[FlagIsUndeclared]        = false;
                _flags[FlagDeclared]            = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, false) != null;
                _flags[FlagDeclarationRequired] = configRecord.IsRootDeclaration(factoryRecord.ConfigKey, false);
            }

            // section info
            _flags[FlagLocationLocked] = sectionRecord.Locked;
            _flags[FlagChildrenLocked] = sectionRecord.LockChildren;
            _flags[FlagChildrenLockWithoutFileInput] = sectionRecord.LockChildrenWithoutFileInput;

            if (sectionRecord.HasFileInput)
            {
                SectionInput fileInput = sectionRecord.FileInput;

                _flags[FlagProtectionProviderDetermined] = fileInput.IsProtectionProviderDetermined;
                _protectionProvider = fileInput.ProtectionProvider;

                SectionXmlInfo sectionXmlInfo = fileInput.SectionXmlInfo;

                _configSource                  = sectionXmlInfo.ConfigSource;
                ConfigSourceStreamName         = sectionXmlInfo.ConfigSourceStreamName;
                _overrideMode                  = sectionXmlInfo.OverrideModeSetting;
                _flags[FlagInheritInChildApps] = !sectionXmlInfo.SkipInChildApps;
                ProtectionProviderName         = sectionXmlInfo.ProtectionProviderName;
            }
            else
            {
                _flags[FlagProtectionProviderDetermined] = false;
                _protectionProvider = null;
            }

            // element context information
            _configurationSection.AssociateContext(configRecord);
        }
 public virtual bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition,
                                         ConfigurationAllowExeDefinition allowExeDefinition)
 {
     if (allowDefinition == ConfigurationAllowDefinition.MachineOnly)
     {
         return(false);
     }
     return(true);
 }
Exemple #13
0
 public SectionInfo(string sectionName, SectionInformation info)
 {
     Name                      = sectionName;
     TypeName                  = info.Type;
     _allowLocation            = info.AllowLocation;
     _allowDefinition          = info.AllowDefinition;
     _allowExeDefinition       = info.AllowExeDefinition;
     _requirePermission        = info.RequirePermission;
     _restartOnExternalChanges = info.RestartOnExternalChanges;
 }
Exemple #14
0
		public SectionInfo (string sectionName, SectionInformation info)
		{
			Name = sectionName;
			TypeName = info.Type;
			this.allowLocation = info.AllowLocation;
			this.allowDefinition = info.AllowDefinition;
			this.allowExeDefinition = info.AllowExeDefinition;
			this.requirePermission = info.RequirePermission;
			this.restartOnExternalChanges = info.RestartOnExternalChanges;
		}
Exemple #15
0
 internal SectionInformation(ConfigurationSection associatedConfigurationSection)
 {
     this._configurationSection = associatedConfigurationSection;
     this._allowDefinition      = ConfigurationAllowDefinition.Everywhere;
     this._allowExeDefinition   = ConfigurationAllowExeDefinition.MachineToApplication;
     this._overrideModeDefault  = System.Configuration.OverrideModeSetting.SectionDefault;
     this._overrideMode         = System.Configuration.OverrideModeSetting.LocationDefault;
     this._flags[8]             = true;
     this._flags[0x10]          = true;
     this._flags[0x20]          = true;
     this._flags[0x100]         = true;
     this._flags[0x1000]        = false;
     this._modifiedFlags        = new SimpleBitVector32();
 }
 internal SectionInformation(ConfigurationSection associatedConfigurationSection)
 {
     this._configurationSection = associatedConfigurationSection;
     this._allowDefinition = ConfigurationAllowDefinition.Everywhere;
     this._allowExeDefinition = ConfigurationAllowExeDefinition.MachineToApplication;
     this._overrideModeDefault = System.Configuration.OverrideModeSetting.SectionDefault;
     this._overrideMode = System.Configuration.OverrideModeSetting.LocationDefault;
     this._flags[8] = true;
     this._flags[0x10] = true;
     this._flags[0x20] = true;
     this._flags[0x100] = true;
     this._flags[0x1000] = false;
     this._modifiedFlags = new SimpleBitVector32();
 }
Exemple #17
0
        public virtual bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            switch (allowDefinition)
            {
            case ConfigurationAllowDefinition.MachineOnly:
                return(configPath == "machine");

            case ConfigurationAllowDefinition.MachineToApplication:
                return(configPath == "machine" || configPath == "exe");

            default:
                return(true);
            }
        }
        // </Snippet94>

        static public void GetAllowProperties()
        {
            // <Snippet95>
            // Get the current configuration file.
            System.Configuration.Configuration config =
                ConfigurationManager.OpenExeConfiguration(
                    ConfigurationUserLevel.None);

            // Get the section.
            UrlsSection section =
                (UrlsSection)config.GetSection("MyUrls");


            SectionInformation sInfo =
                section.SectionInformation;
            // </Snippet95>

            // <Snippet96>
            ConfigurationAllowDefinition allowDefinition =
                sInfo.AllowDefinition;

            Console.WriteLine("Allow definition: {0}",
                              allowDefinition.ToString());
            // </Snippet96>

            // <Snippet97>
            ConfigurationAllowExeDefinition allowExeDefinition =
                sInfo.AllowExeDefinition;

            Console.WriteLine("Allow exe definition: {0}",
                              allowExeDefinition.ToString());
            // </Snippet97>

            // <Snippet98>
            bool allowLocation =
                sInfo.AllowLocation;

            Console.WriteLine("Allow location: {0}",
                              allowLocation.ToString());
            // </Snippet98>

            // <Snippet99>
            bool allowOverride =
                sInfo.AllowOverride;

            Console.WriteLine("Allow override: {0}",
                              allowOverride.ToString());
            // </Snippet99>
        }
Exemple #19
0
 internal void SetRuntimeConfigurationInformation(BaseConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord)
 {
     this._flags[1]            = true;
     this._configKey           = factoryRecord.ConfigKey;
     this._group               = factoryRecord.Group;
     this._name                = factoryRecord.Name;
     this._typeName            = factoryRecord.FactoryTypeName;
     this._allowDefinition     = factoryRecord.AllowDefinition;
     this._allowExeDefinition  = factoryRecord.AllowExeDefinition;
     this._flags[8]            = factoryRecord.AllowLocation;
     this._flags[0x10]         = factoryRecord.RestartOnExternalChanges;
     this._flags[0x20]         = factoryRecord.RequirePermission;
     this._overrideModeDefault = factoryRecord.OverrideModeDefault;
     if (factoryRecord.IsUndeclared)
     {
         this._flags[0x2000] = true;
         this._flags[2]      = false;
         this._flags[4]      = false;
     }
     else
     {
         this._flags[0x2000] = false;
         this._flags[2]      = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, false) != null;
         this._flags[4]      = configRecord.IsRootDeclaration(factoryRecord.ConfigKey, false);
     }
     this._flags[0x40]   = sectionRecord.Locked;
     this._flags[0x80]   = sectionRecord.LockChildren;
     this._flags[0x4000] = sectionRecord.LockChildrenWithoutFileInput;
     if (sectionRecord.HasFileInput)
     {
         SectionInput fileInput = sectionRecord.FileInput;
         this._flags[0x800]       = fileInput.IsProtectionProviderDetermined;
         this._protectionProvider = fileInput.ProtectionProvider;
         SectionXmlInfo sectionXmlInfo = fileInput.SectionXmlInfo;
         this._configSource           = sectionXmlInfo.ConfigSource;
         this._configSourceStreamName = sectionXmlInfo.ConfigSourceStreamName;
         this._overrideMode           = sectionXmlInfo.OverrideModeSetting;
         this._flags[0x100]           = !sectionXmlInfo.SkipInChildApps;
         this._protectionProviderName = sectionXmlInfo.ProtectionProviderName;
     }
     else
     {
         this._flags[0x800]       = false;
         this._protectionProvider = null;
     }
     this._configurationSection.AssociateContext(configRecord);
 }
        //
        // Constructor
        //
        internal SectionInformation(ConfigurationSection associatedConfigurationSection) {
            _configKey = String.Empty;
            _group = String.Empty;
            _name = String.Empty;

            _configurationSection     = associatedConfigurationSection;
            _allowDefinition          = ConfigurationAllowDefinition.Everywhere;
            _allowExeDefinition       = ConfigurationAllowExeDefinition.MachineToApplication;

            _flags[ Flag_AllowLocation            ] = true;
            _flags[ Flag_RestartOnExternalChanges ] = true;
            _flags[ Flag_RequirePermission        ] = true;
            _flags[ Flag_AllowOverride            ] = true;
            _flags[ Flag_InheritInChildApps       ] = true;
            _flags[ Flag_ForceSave                ] = false;

            _modifiedFlags = new SimpleBitVector32();
        }
Exemple #21
0
        internal SectionInformation(ConfigurationSection associatedConfigurationSection)
        {
            ConfigKey = string.Empty;
            Name      = string.Empty;

            _configurationSection = associatedConfigurationSection;
            _allowDefinition      = ConfigurationAllowDefinition.Everywhere;
            _allowExeDefinition   = ConfigurationAllowExeDefinition.MachineToApplication;
            _overrideModeDefault  = OverrideModeSetting.s_sectionDefault;
            _overrideMode         = OverrideModeSetting.s_locationDefault;

            _flags[FlagAllowLocation]            = true;
            _flags[FlagRestartOnExternalChanges] = true;
            _flags[FlagRequirePermission]        = true;
            _flags[FlagInheritInChildApps]       = true;
            _flags[FlagForceSave] = false;

            _modifiedFlags = new SimpleBitVector32();
        }
Exemple #22
0
        internal SectionInformation(ConfigurationSection associatedConfigurationSection)
        {
            ConfigKey = string.Empty;
            Name = string.Empty;

            _configurationSection = associatedConfigurationSection;
            _allowDefinition = ConfigurationAllowDefinition.Everywhere;
            _allowExeDefinition = ConfigurationAllowExeDefinition.MachineToApplication;
            _overrideModeDefault = OverrideModeSetting.s_sectionDefault;
            _overrideMode = OverrideModeSetting.s_locationDefault;

            _flags[FlagAllowLocation] = true;
            _flags[FlagRestartOnExternalChanges] = true;
            _flags[FlagRequirePermission] = true;
            _flags[FlagInheritInChildApps] = true;
            _flags[FlagForceSave] = false;

            _modifiedFlags = new SimpleBitVector32();
        }
        //
        // Constructor
        //
        internal SectionInformation(ConfigurationSection associatedConfigurationSection)
        {
            _configKey = String.Empty;
            _group     = String.Empty;
            _name      = String.Empty;

            _configurationSection = associatedConfigurationSection;
            _allowDefinition      = ConfigurationAllowDefinition.Everywhere;
            _allowExeDefinition   = ConfigurationAllowExeDefinition.MachineToApplication;

            _flags[Flag_AllowLocation]            = true;
            _flags[Flag_RestartOnExternalChanges] = true;
            _flags[Flag_RequirePermission]        = true;
            _flags[Flag_AllowOverride]            = true;
            _flags[Flag_InheritInChildApps]       = true;
            _flags[Flag_ForceSave] = false;

            _modifiedFlags = new SimpleBitVector32();
        }
Exemple #24
0
        public virtual bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition,
                                                ConfigurationAllowExeDefinition allowExeDefinition)
        {
            switch (allowDefinition)
            {
            case ConfigurationAllowDefinition.MachineOnly:
                return(configPath == MachinePath || configPath == MachineWebPath);

            case ConfigurationAllowDefinition.MachineToWebRoot:
            case ConfigurationAllowDefinition.MachineToApplication:
                if (String.IsNullOrEmpty(configPath))
                {
                    return(true);
                }
                string normalized;

                if (VirtualPathUtility.IsRooted(configPath))
                {
                    normalized = VirtualPathUtility.Normalize(configPath);
                }
                else
                {
                    normalized = configPath;
                }

                if ((String.Compare(normalized, MachinePath, StringComparison.Ordinal) == 0) ||
                    (String.Compare(normalized, MachineWebPath, StringComparison.Ordinal) == 0))
                {
                    return(true);
                }

                if ((String.Compare(normalized, appVirtualPath) != 0))
                {
                    return(IsApplication(normalized));
                }

                return(true);

            default:
                return(true);
            }
        }
 public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     if (!this.IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
     {
         ConfigurationAllowExeDefinition definition = allowExeDefinition;
         if (definition != ConfigurationAllowExeDefinition.MachineOnly)
         {
             if (definition == ConfigurationAllowExeDefinition.MachineToApplication)
             {
                 throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_allow_exedefinition_error_application"), errorInfo);
             }
             if (definition == ConfigurationAllowExeDefinition.MachineToRoamingUser)
             {
                 throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_allow_exedefinition_error_roaminguser"), errorInfo);
             }
             throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::VerifyDefinitionAllowed");
         }
         throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_allow_exedefinition_error_machine"), errorInfo);
     }
 }
        internal bool IsEquivalentSectionFactory(
            IInternalConfigHost host,
            string typeName,
            bool allowLocation,
            ConfigurationAllowDefinition allowDefinition,
            ConfigurationAllowExeDefinition allowExeDefinition,
            bool restartOnExternalChanges,
            bool requirePermission)
        {
            if ((allowLocation != AllowLocation) ||
                (allowDefinition != AllowDefinition) ||
                (allowExeDefinition != AllowExeDefinition) ||
                (restartOnExternalChanges != RestartOnExternalChanges) ||
                (requirePermission != RequirePermission))
            {
                return(false);
            }

            return(IsEquivalentType(host, typeName));
        }
Exemple #27
0
 public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     if (!this.IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
     {
         ConfigurationAllowDefinition definition = allowDefinition;
         if (definition != ConfigurationAllowDefinition.MachineOnly)
         {
             if (definition == ConfigurationAllowDefinition.MachineToWebRoot)
             {
                 throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_allow_definition_error_webroot"), errorInfo.Filename, errorInfo.LineNumber);
             }
             if (definition == ConfigurationAllowDefinition.MachineToApplication)
             {
                 throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_allow_definition_error_application"), errorInfo.Filename, errorInfo.LineNumber);
             }
             throw System.Web.Util.ExceptionUtil.UnexpectedError("WebConfigurationHost::VerifyDefinitionAllowed");
         }
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_allow_definition_error_machine"), errorInfo.Filename, errorInfo.LineNumber);
     }
 }
Exemple #28
0
        internal bool IsEquivalentSectionFactory(
            IInternalConfigHost             host,
            string                          typeName,
            bool                            allowLocation,
            ConfigurationAllowDefinition    allowDefinition,
            ConfigurationAllowExeDefinition allowExeDefinition,
            bool                            restartOnExternalChanges,
            bool                            requirePermission) {

            if (    allowLocation               != this.AllowLocation               ||
                    allowDefinition             != this.AllowDefinition             ||
                    allowExeDefinition          != this.AllowExeDefinition          ||
                    restartOnExternalChanges    != this.RestartOnExternalChanges    ||
                    requirePermission           != this.RequirePermission) {

                return false;
            }

            return IsEquivalentType(host, typeName);
        }
        public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
        {
            if (!IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
            {
                switch (allowDefinition)
                {
                case ConfigurationAllowDefinition.MachineOnly:
                    throw new ConfigurationErrorsException(SR.GetString(SR.Config_allow_definition_error_machine), errorInfo.Filename, errorInfo.LineNumber);

                case ConfigurationAllowDefinition.MachineToWebRoot:
                    throw new ConfigurationErrorsException(SR.GetString(SR.Config_allow_definition_error_webroot), errorInfo.Filename, errorInfo.LineNumber);

                case ConfigurationAllowDefinition.MachineToApplication:
                    throw new ConfigurationErrorsException(SR.GetString(SR.Config_allow_definition_error_application), errorInfo.Filename, errorInfo.LineNumber);

                default:
                    // If we have extended ConfigurationAllowDefinition
                    // make sure to update this switch accordingly
                    throw ExceptionUtil.UnexpectedError("WebConfigurationHost::VerifyDefinitionAllowed");
                }
            }
        }
Exemple #30
0
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            switch (allowDefinition)
            {
            case ConfigurationAllowDefinition.MachineToApplication:
                if (!string.IsNullOrEmpty(this._appConfigPath) && (configPath.Length > this._appConfigPath.Length))
                {
                    return(this.IsApplication(configPath));
                }
                return(true);

            case ConfigurationAllowDefinition.Everywhere:
                return(true);

            case ConfigurationAllowDefinition.MachineOnly:
                return(configPath.Length <= "machine".Length);

            case ConfigurationAllowDefinition.MachineToWebRoot:
                return(configPath.Length <= "machine/webroot".Length);
            }
            throw System.Web.Util.ExceptionUtil.UnexpectedError("WebConfigurationHost::IsDefinitionAllowed");
        }
 public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     if (!this.IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
     {
         ConfigurationAllowExeDefinition definition = allowExeDefinition;
         if (definition != ConfigurationAllowExeDefinition.MachineOnly)
         {
             if (definition == ConfigurationAllowExeDefinition.MachineToApplication)
             {
                 throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_allow_exedefinition_error_application"), errorInfo);
             }
             if (definition == ConfigurationAllowExeDefinition.MachineToRoamingUser)
             {
                 throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_allow_exedefinition_error_roaminguser"), errorInfo);
             }
             throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::VerifyDefinitionAllowed");
         }
         throw new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_allow_exedefinition_error_machine"), errorInfo);
     }
 }
        public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo) {
            if (!IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition)) {
                switch (allowDefinition) {
                    case ConfigurationAllowDefinition.MachineOnly:
                        throw new ConfigurationErrorsException(SR.GetString(SR.Config_allow_definition_error_machine), errorInfo.Filename, errorInfo.LineNumber);

                    case ConfigurationAllowDefinition.MachineToWebRoot:
                        throw new ConfigurationErrorsException(SR.GetString(SR.Config_allow_definition_error_webroot), errorInfo.Filename, errorInfo.LineNumber);

                    case ConfigurationAllowDefinition.MachineToApplication:
                        throw new ConfigurationErrorsException(SR.GetString(SR.Config_allow_definition_error_application), errorInfo.Filename, errorInfo.LineNumber);

                    default:
                        // If we have extended ConfigurationAllowDefinition
                        // make sure to update this switch accordingly
                        throw ExceptionUtil.UnexpectedError("WebConfigurationHost::VerifyDefinitionAllowed");
                }
            }
        }
 internal void SetRuntimeConfigurationInformation(BaseConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord)
 {
     this._flags[1] = true;
     this._configKey = factoryRecord.ConfigKey;
     this._group = factoryRecord.Group;
     this._name = factoryRecord.Name;
     this._typeName = factoryRecord.FactoryTypeName;
     this._allowDefinition = factoryRecord.AllowDefinition;
     this._allowExeDefinition = factoryRecord.AllowExeDefinition;
     this._flags[8] = factoryRecord.AllowLocation;
     this._flags[0x10] = factoryRecord.RestartOnExternalChanges;
     this._flags[0x20] = factoryRecord.RequirePermission;
     this._overrideModeDefault = factoryRecord.OverrideModeDefault;
     if (factoryRecord.IsUndeclared)
     {
         this._flags[0x2000] = true;
         this._flags[2] = false;
         this._flags[4] = false;
     }
     else
     {
         this._flags[0x2000] = false;
         this._flags[2] = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, false) != null;
         this._flags[4] = configRecord.IsRootDeclaration(factoryRecord.ConfigKey, false);
     }
     this._flags[0x40] = sectionRecord.Locked;
     this._flags[0x80] = sectionRecord.LockChildren;
     this._flags[0x4000] = sectionRecord.LockChildrenWithoutFileInput;
     if (sectionRecord.HasFileInput)
     {
         SectionInput fileInput = sectionRecord.FileInput;
         this._flags[0x800] = fileInput.IsProtectionProviderDetermined;
         this._protectionProvider = fileInput.ProtectionProvider;
         SectionXmlInfo sectionXmlInfo = fileInput.SectionXmlInfo;
         this._configSource = sectionXmlInfo.ConfigSource;
         this._configSourceStreamName = sectionXmlInfo.ConfigSourceStreamName;
         this._overrideMode = sectionXmlInfo.OverrideModeSetting;
         this._flags[0x100] = !sectionXmlInfo.SkipInChildApps;
         this._protectionProviderName = sectionXmlInfo.ProtectionProviderName;
     }
     else
     {
         this._flags[0x800] = false;
         this._protectionProvider = null;
     }
     this._configurationSection.AssociateContext(configRecord);
 }
Exemple #34
0
		public virtual bool IsDefinitionAllowed (string configPath, ConfigurationAllowDefinition allowDefinition,
							 ConfigurationAllowExeDefinition allowExeDefinition)
		{
			switch (allowDefinition) {
				case ConfigurationAllowDefinition.MachineOnly:
					return configPath == MachinePath || configPath == MachineWebPath;
				case ConfigurationAllowDefinition.MachineToWebRoot:
				case ConfigurationAllowDefinition.MachineToApplication:
					if (String.IsNullOrEmpty (configPath))
						return true;
					string normalized;

					if (VirtualPathUtility.IsRooted (configPath))
						normalized = VirtualPathUtility.Normalize (configPath);
					else
						normalized = configPath;
					
					if ((String.Compare (normalized, MachinePath, StringComparison.Ordinal) == 0) ||
						(String.Compare (normalized, MachineWebPath, StringComparison.Ordinal) == 0))
							return true;
				
					if ((String.Compare (normalized, appVirtualPath) != 0))
						return IsApplication (normalized);
				
					return true;
				default:
					return true;
			}
		}
Exemple #35
0
 void IInternalConfigHost.VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition,
                                                  ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
 }
 internal bool IsEquivalentSectionFactory(IInternalConfigHost host, string typeName, bool allowLocation, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, bool restartOnExternalChanges, bool requirePermission)
 {
     return ((((allowLocation == this.AllowLocation) && (allowDefinition == this.AllowDefinition)) && (((allowExeDefinition == this.AllowExeDefinition) && (restartOnExternalChanges == this.RestartOnExternalChanges)) && (requirePermission == this.RequirePermission))) && this.IsEquivalentType(host, typeName));
 }
Exemple #37
0
 public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
 {
     return(true);
 }
 void IInternalConfigHost.VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo) {
 }
 public virtual void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo) {
     Host.VerifyDefinitionAllowed(configPath, allowDefinition, allowExeDefinition, errorInfo);
 }
 public virtual bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition) {
     return Host.IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition);
 }
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            switch (allowDefinition)
            {
                case ConfigurationAllowDefinition.MachineToApplication:
                    if (!string.IsNullOrEmpty(this._appConfigPath) && (configPath.Length > this._appConfigPath.Length))
                    {
                        return this.IsApplication(configPath);
                    }
                    return true;

                case ConfigurationAllowDefinition.Everywhere:
                    return true;

                case ConfigurationAllowDefinition.MachineOnly:
                    return (configPath.Length <= "machine".Length);

                case ConfigurationAllowDefinition.MachineToWebRoot:
                    return (configPath.Length <= "machine/webroot".Length);
            }
            throw System.Web.Util.ExceptionUtil.UnexpectedError("WebConfigurationHost::IsDefinitionAllowed");
        }
        internal void SetRuntimeConfigurationInformation(BaseConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord) {
            _flags[ Flag_Attached ] = true;

            // factory info
            _configKey          = factoryRecord.ConfigKey;
            _group              = factoryRecord.Group;
            _name               = factoryRecord.Name;
            _typeName           = factoryRecord.FactoryTypeName;
            _allowDefinition    = factoryRecord.AllowDefinition;
            _allowExeDefinition = factoryRecord.AllowExeDefinition;
            _flags[ Flag_AllowLocation            ] = factoryRecord.AllowLocation;
            _flags[ Flag_RestartOnExternalChanges ] = factoryRecord.RestartOnExternalChanges;
            _flags[ Flag_RequirePermission        ] = factoryRecord.RequirePermission;

            if (factoryRecord.IsUndeclared) {
                _flags[ Flag_IsUndeclared             ] = true;
                _flags[ Flag_Declared                 ] = false;
                _flags[ Flag_DeclarationRequired      ] = false;
            }
            else {
                _flags[ Flag_IsUndeclared             ] = false;
                _flags[ Flag_Declared                 ] = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, false) != null;
                _flags[ Flag_DeclarationRequired      ] = configRecord.IsRootDeclaration(factoryRecord.ConfigKey, false);
            }

            // section info
            _flags[ Flag_LocationLocked ]           = sectionRecord.Locked;

            if (sectionRecord.HasFileInput) {
                SectionInput fileInput = sectionRecord.FileInput;

                _flags[ Flag_ProtectionProviderDetermined ] = fileInput.IsProtectionProviderDetermined;
                _protectionProvider                         = fileInput.ProtectionProvider;
                
                SectionXmlInfo sectionXmlInfo = fileInput.SectionXmlInfo;

                _configSource                       = sectionXmlInfo.ConfigSource;
                _configSourceStreamName             = sectionXmlInfo.ConfigSourceStreamName;
                _flags[ Flag_AllowOverride ]        = !sectionXmlInfo.LockChildren;
                _flags[ Flag_InheritInChildApps ]   = !sectionXmlInfo.SkipInChildApps;
                _protectionProviderName             = sectionXmlInfo.ProtectionProviderName;
            }
            else {
                _flags[ Flag_ProtectionProviderDetermined ] = false;
                _protectionProvider = null;
            }

            // element context information
            _configurationSection.AssociateContext( configRecord );
        }
 public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     if (!this.IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
     {
         ConfigurationAllowDefinition definition = allowDefinition;
         if (definition != ConfigurationAllowDefinition.MachineOnly)
         {
             if (definition == ConfigurationAllowDefinition.MachineToWebRoot)
             {
                 throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_allow_definition_error_webroot"), errorInfo.Filename, errorInfo.LineNumber);
             }
             if (definition == ConfigurationAllowDefinition.MachineToApplication)
             {
                 throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_allow_definition_error_application"), errorInfo.Filename, errorInfo.LineNumber);
             }
             throw System.Web.Util.ExceptionUtil.UnexpectedError("WebConfigurationHost::VerifyDefinitionAllowed");
         }
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Config_allow_definition_error_machine"), errorInfo.Filename, errorInfo.LineNumber);
     }
 }
 bool IInternalConfigHost.IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition) {
     return true;
 }
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            string str;
            switch (allowExeDefinition)
            {
                case ConfigurationAllowExeDefinition.MachineToRoamingUser:
                    str = "MACHINE/EXE/ROAMING_USER";
                    break;

                case ConfigurationAllowExeDefinition.MachineToLocalUser:
                    return true;

                case ConfigurationAllowExeDefinition.MachineOnly:
                    str = "MACHINE";
                    break;

                case ConfigurationAllowExeDefinition.MachineToApplication:
                    str = "MACHINE/EXE";
                    break;

                default:
                    throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::IsDefinitionAllowed");
            }
            return (configPath.Length <= str.Length);
        }
        public override void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
        {
            if (!IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition))
            {
                switch (allowExeDefinition)
                {
                    case ConfigurationAllowExeDefinition.MachineOnly:
                        throw new ConfigurationErrorsException(
                            SR.GetString(SR.Config_allow_exedefinition_error_machine), errorInfo);

                    case ConfigurationAllowExeDefinition.MachineToApplication:
                        throw new ConfigurationErrorsException(
                            SR.GetString(SR.Config_allow_exedefinition_error_application), errorInfo);

                    case ConfigurationAllowExeDefinition.MachineToRoamingUser:
                        throw new ConfigurationErrorsException(
                            SR.GetString(SR.Config_allow_exedefinition_error_roaminguser), errorInfo);

                    default:
                        // If we have extended ConfigurationAllowExeDefinition
                        // make sure to update this switch accordingly
                        throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::VerifyDefinitionAllowed");
                }
            }
        }
 internal bool IsEquivalentSectionFactory(IInternalConfigHost host, string typeName, bool allowLocation, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, bool restartOnExternalChanges, bool requirePermission)
 {
     return((((allowLocation == this.AllowLocation) && (allowDefinition == this.AllowDefinition)) && (((allowExeDefinition == this.AllowExeDefinition) && (restartOnExternalChanges == this.RestartOnExternalChanges)) && (requirePermission == this.RequirePermission))) && this.IsEquivalentType(host, typeName));
 }
 public virtual void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     host.VerifyDefinitionAllowed(configPath, allowDefinition, allowExeDefinition, errorInfo);
 }
Exemple #49
0
 bool IInternalConfigHost.IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition,
                                              ConfigurationAllowExeDefinition allowExeDefinition)
 {
     return(true);
 }
		public virtual void VerifyDefinitionAllowed (string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
		{
			if (!IsDefinitionAllowed (configPath, allowDefinition, allowExeDefinition))
				throw new ConfigurationErrorsException ("The section can't be defined in this file (the allowed definition context is '" + allowDefinition + "').", errorInfo.Filename, errorInfo.LineNumber);
		}
 public virtual bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
 {
     return(host.IsDefinitionAllowed(configPath, allowDefinition, allowExeDefinition));
 }
Exemple #52
0
 void IInternalConfigHost.VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo)
 {
     throw new NotImplementedException();
 }
		public virtual bool IsDefinitionAllowed (string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
		{
			switch (allowDefinition) {
				case ConfigurationAllowDefinition.MachineOnly:
					return configPath == "machine";
				case ConfigurationAllowDefinition.MachineToApplication:
					return configPath == "machine" || configPath == "exe";
				default:
					return true;
			}
		}
 internal bool IsDefinitionAllowed(ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition) {
     return Host.IsDefinitionAllowed(_configPath, allowDefinition, allowExeDefinition);
 }
		public override bool IsDefinitionAllowed (string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
		{
			return true;
		}
Exemple #56
0
		public override void ReadConfig (Configuration cfg, string streamName, XmlReader reader)
		{
			StreamName = streamName;
			ConfigHost = cfg.ConfigHost;

			while (reader.MoveToNextAttribute ()) {
				switch (reader.Name)
				{
					case "allowLocation":
						string allowLoc = reader.Value;
						allowLocation = (allowLoc == "true");
						if (!allowLocation && allowLoc != "false")
							ThrowException ("Invalid attribute value", reader);
						break;
	
					case "allowDefinition":
						string allowDef = reader.Value;
						try {
							allowDefinition = (ConfigurationAllowDefinition) Enum.Parse (
									   typeof (ConfigurationAllowDefinition), allowDef);
						} catch {
							ThrowException ("Invalid attribute value", reader);
						}
						break;
	
					case "allowExeDefinition":
						string allowExeDef = reader.Value;
						try {
							allowExeDefinition = (ConfigurationAllowExeDefinition) Enum.Parse (
									   typeof (ConfigurationAllowExeDefinition), allowExeDef);
						} catch {
							ThrowException ("Invalid attribute value", reader);
						}
						break;
	
					case "type":
						TypeName = reader.Value;
						break;
					
					case "name":
						Name = reader.Value;
						if (Name == "location")
							ThrowException ("location is a reserved section name", reader);
						break;
						
					case "requirePermission":
						string reqPerm = reader.Value;
						bool reqPermValue = (reqPerm == "true");
						if (!reqPermValue && reqPerm != "false")
							ThrowException ("Invalid attribute value", reader);
						requirePermission = reqPermValue;
						break;

					case "restartOnExternalChanges":
						string restart = reader.Value;
						bool restartValue = (restart == "true");
						if (!restartValue && restart != "false")
							ThrowException ("Invalid attribute value", reader);
						restartOnExternalChanges = restartValue;
						break;

					default:
						ThrowException (String.Format ("Unrecognized attribute: {0}", reader.Name), reader);
						break;
				}
			}

			if (Name == null || TypeName == null)
				ThrowException ("Required attribute missing", reader);

			reader.MoveToElement();
			reader.Skip ();
		}
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition)
        {
            string allowedConfigPath;

            switch (allowExeDefinition)
            {
                case ConfigurationAllowExeDefinition.MachineOnly:
                    allowedConfigPath = MachineConfigPath;
                    break;

                case ConfigurationAllowExeDefinition.MachineToApplication:
                    allowedConfigPath = ExeConfigPath;
                    break;

                case ConfigurationAllowExeDefinition.MachineToRoamingUser:
                    allowedConfigPath = RoamingUserConfigPath;
                    break;

                // MachineToLocalUser does not current have any definition restrictions
                case ConfigurationAllowExeDefinition.MachineToLocalUser:
                    return true;

                default:
                    // If we have extended ConfigurationAllowExeDefinition
                    // make sure to update this switch accordingly
                    throw ExceptionUtil.UnexpectedError("ClientConfigurationHost::IsDefinitionAllowed");
            }

            return configPath.Length <= allowedConfigPath.Length;
        }
        public override bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition) {
            switch (allowDefinition) {
                case ConfigurationAllowDefinition.MachineOnly:
                    return configPath.Length <= MachineConfigPath.Length;

                case ConfigurationAllowDefinition.MachineToWebRoot:
                    return configPath.Length <= RootWebConfigPath.Length;

                case ConfigurationAllowDefinition.MachineToApplication:
                    // In some scenarios the host does not have an application path.
                    // Allow all definitions in this case.
                    return  String.IsNullOrEmpty(_appConfigPath) ||
                            (configPath.Length <= _appConfigPath.Length) ||
                            IsApplication(configPath);

                // MachineToLocalUser does not current have any definition restrictions
                case ConfigurationAllowDefinition.Everywhere:
                    return true;

                default:
                    // If we have extended ConfigurationAllowDefinition
                    // make sure to update this switch accordingly
                    throw ExceptionUtil.UnexpectedError("WebConfigurationHost::IsDefinitionAllowed");
            }
        }