Example #1
0
        internal static CodeSubDirectoriesCollection GetCodeSubDirectories()
        {
            CodeSubDirectoriesCollection codeSubDirectories = MTConfigUtil.GetCompilationAppConfig().CodeSubDirectories;

            if (codeSubDirectories != null)
            {
                codeSubDirectories.EnsureRuntimeValidation();
            }
            return(codeSubDirectories);
        }
Example #2
0
        internal static CodeSubDirectoriesCollection GetCodeSubDirectories()
        {
            // Get the <compilation> config object
            CompilationSection config = MTConfigUtil.GetCompilationAppConfig();

            CodeSubDirectoriesCollection codeSubDirectories = config.CodeSubDirectories;

            // Make sure the config data is valid
            if (codeSubDirectories != null)
            {
                codeSubDirectories.EnsureRuntimeValidation();
            }

            return(codeSubDirectories);
        }
Example #3
0
        private static Type GetPropType(string typeName)
        {
            Exception exception = null;

            try
            {
                return(Type.GetType(typeName, true, true));
            }
            catch (Exception exception2)
            {
                exception = exception2;
            }
            try
            {
                CompilationSection compilationAppConfig = MTConfigUtil.GetCompilationAppConfig();
                if (compilationAppConfig != null)
                {
                    AssemblyCollection assemblies = compilationAppConfig.Assemblies;
                    if (assemblies != null)
                    {
                        foreach (Assembly assembly in assemblies)
                        {
                            Type type = assembly.GetType(typeName, false, true);
                            if (type != null)
                            {
                                return(type);
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            throw exception;
        }
Example #4
0
        private static void EnsureSettingsLoaded()
        {
            if (!_settingsInitialized)
            {
                lock (_appSettingsLock) {
                    if (!_settingsInitialized)
                    {
                        NameValueCollection settings = null;

                        try {
                            settings = GetAppSettingsSection();
                        } finally {
                            // GetApplicationPathData may throw.  That's fine.  Let the user see the exception
                            // once, but just fall back on default settings for the future.
                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseHostHeaderForRequestUrl"], out _useHostHeaderForRequestUrl))
                            {
                                _useHostHeaderForRequestUrl = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:AllowAnonymousImpersonation"], out _allowAnonymousImpersonation))
                            {
                                _allowAnonymousImpersonation = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:ScriptResourceAllowNonJsFiles"], out _scriptResourceAllowNonJsFiles))
                            {
                                _scriptResourceAllowNonJsFiles = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseLegacyEncryption"], out _useLegacyEncryption))
                            {
                                _useLegacyEncryption = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseLegacyMachineKeyEncryption"], out _useLegacyMachineKeyEncryption))
                            {
                                _useLegacyMachineKeyEncryption = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseLegacyFormsAuthenticationTicketCompatibility"], out _useLegacyFormsAuthenticationTicketCompatibility))
                            {
                                _useLegacyFormsAuthenticationTicketCompatibility = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseLegacyEventValidationCompatibility"], out _useLegacyEventValidationCompatibility))
                            {
                                _useLegacyEventValidationCompatibility = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:AllowRelaxedHttpUserName"], out _allowRelaxedHttpUserName))
                            {
                                _allowRelaxedHttpUserName = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:JavaScriptDoNotEncodeAmpersand"], out _javaScriptDoNotEncodeAmpersand))
                            {
                                _javaScriptDoNotEncodeAmpersand = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseTaskFriendlySynchronizationContext"], out _useTaskFriendlySynchronizationContext))
                            {
                                _useTaskFriendlySynchronizationContext = (BinaryCompatibility.Current.TargetsAtLeastFramework45) ? true : false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:AllowAsyncDuringSyncStages"], out _allowAsyncDuringSyncStages))
                            {
                                _allowAsyncDuringSyncStages = false;
                            }

                            if (settings == null || !int.TryParse(settings["aspnet:MaxHttpCollectionKeys"], out _maxHttpCollectionKeys) || _maxHttpCollectionKeys < 0)
                            {
                                _maxHttpCollectionKeys = DefaultMaxHttpCollectionKeys;
                            }

                            if (settings == null || !int.TryParse(settings["aspnet:MaxJsonDeserializerMembers"], out _maxJsonDeserializerMembers) || _maxJsonDeserializerMembers < 0)
                            {
                                _maxJsonDeserializerMembers = DefaultMaxJsonDeserializerMembers;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:DoNotDisposeSpecialHttpApplicationInstances"], out _doNotDisposeSpecialHttpApplicationInstances))
                            {
                                _doNotDisposeSpecialHttpApplicationInstances = false;
                            }

                            if (settings != null)
                            {
                                _formsAuthReturnUrlVar = settings["aspnet:FormsAuthReturnUrlVar"];
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:RestrictXmlControls"], out _restrictXmlControls))
                            {
                                _restrictXmlControls = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:AllowRelaxedRelativeUrl"], out _allowRelaxedRelativeUrl))
                            {
                                _allowRelaxedRelativeUrl = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:UseLegacyRequestUrlGeneration"], out _useLegacyRequestUrlGeneration))
                            {
                                _useLegacyRequestUrlGeneration = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:AllowUtf7RequestContentEncoding"], out _allowUtf7RequestContentEncoding))
                            {
                                _allowUtf7RequestContentEncoding = false;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:AllowRelaxedUnicodeDecoding"], out _allowRelaxedUnicodeDecoding))
                            {
                                _allowRelaxedUnicodeDecoding = false;
                            }

                            if (settings == null || !int.TryParse(settings["aspnet:UpdatePanelMaxScriptLength"], out _updatePanelMaxScriptLength) || _updatePanelMaxScriptLength < 0)
                            {
                                _updatePanelMaxScriptLength = 0;
                            }

                            // AppSettings override allows users to build against 4.5 but run against 4.0 or 4.5
                            if (settings == null || !int.TryParse(settings["aspnet:MaxConcurrentCompilations"], out _maxConcurrentCompilations) || _maxConcurrentCompilations < 0)
                            {
                                CompilationSection config = MTConfigUtil.GetCompilationAppConfig();
                                _maxConcurrentCompilations = config.MaxConcurrentCompilations;
                            }
                            if (_maxConcurrentCompilations <= 0)
                            {
                                _maxConcurrentCompilations = Environment.ProcessorCount;
                            }

                            if (settings == null || !int.TryParse(settings["aspnet:MaxAcceptLanguageFallbackCount"], out _maxAcceptLanguageFallbackCount) || _maxAcceptLanguageFallbackCount <= 0)
                            {
                                _maxAcceptLanguageFallbackCount = DefaultMaxAcceptLanguageFallbackCount;
                            }

                            if (settings == null || !Boolean.TryParse(settings["aspnet:PortableCompilationOutput"], out _portableCompilationOutput))
                            {
                                _portableCompilationOutput = false;
                            }

                            if (settings == null || string.IsNullOrWhiteSpace(_portableCompilationOutputSnapshotType = settings["aspnet:PortableCompilationOutputSnapshotType"]))
                            {
                                _portableCompilationOutputSnapshotType = null;
                            }

                            if (settings == null || string.IsNullOrWhiteSpace(_portableCompilationOutputSnapshotTypeOptions = settings["aspnet:PortableCompilationOutputSnapshotTypeOptions"]))
                            {
                                _portableCompilationOutputSnapshotTypeOptions = null;
                            }

                            _settingsInitialized = true;
                        }
                    }
                }
            }
        }
Example #5
0
        static BaseCodeDomTreeGenerator()
        {
            CompilationSection config = MTConfigUtil.GetCompilationAppConfig();

            _urlLinePragmas = config.UrlLinePragmas;
        }
Example #6
0
        internal static int GetRecompilationsBeforeAppRestarts()
        {
            CompilationSection config = MTConfigUtil.GetCompilationAppConfig();

            return(config.NumRecompilesBeforeAppRestart);
        }
Example #7
0
 internal static int GetRecompilationsBeforeAppRestarts()
 {
     return(MTConfigUtil.GetCompilationAppConfig().NumRecompilesBeforeAppRestart);
 }