internal static RuntimeConfig GetAppConfig() { if (!HttpConfigurationSystem.UseHttpConfigurationSystem) { return GetClientRuntimeConfig(); } return CachedPathData.GetApplicationPathData().RuntimeConfig; }
// GetAppSection // // Get the Config for a specific path // static internal object GetApplicationSection(string sectionName) { Debug.Assert(UseHttpConfigurationSystem, "UseHttpConfigurationSystem"); CachedPathData pathData; pathData = CachedPathData.GetApplicationPathData(); return(pathData.ConfigRecord.GetSection(sectionName)); }
private static NameValueCollection GetAppSettingsSection() { // DevDiv #353926 - Fall back to reading App.config if System.Web types are being consumed outside an ASP.NET application if (!HostingEnvironment.IsHosted) { return(ConfigurationManager.AppSettings); } // Check the app-level config. Ignore configuration errors CachedPathData appPathData = CachedPathData.GetApplicationPathData(); if (appPathData != null && appPathData.ConfigRecord != null) { return(appPathData.ConfigRecord.GetSection("appSettings") as NameValueCollection); } // nothing found return(null); }
internal static object GetApplicationSection(string sectionName) { return(CachedPathData.GetApplicationPathData().ConfigRecord.GetSection(sectionName)); }
private static void EnsureSettingsLoaded() { if (!_settingsInitialized) { lock (_appSettingsLock) { if (!_settingsInitialized) { NameValueCollection section = null; try { CachedPathData applicationPathData = CachedPathData.GetApplicationPathData(); if ((applicationPathData != null) && (applicationPathData.ConfigRecord != null)) { section = applicationPathData.ConfigRecord.GetSection("appSettings") as NameValueCollection; } } finally { if ((section == null) || !bool.TryParse(section["aspnet:UseHostHeaderForRequestUrl"], out _useHostHeaderForRequestUrl)) { _useHostHeaderForRequestUrl = false; } if ((section == null) || !bool.TryParse(section["aspnet:ScriptResourceAllowNonJsFiles"], out _scriptResourceAllowNonJsFiles)) { _scriptResourceAllowNonJsFiles = false; } if ((section == null) || !bool.TryParse(section["aspnet:UseLegacyEncryption"], out _useLegacyEncryption)) { _useLegacyEncryption = false; } if ((section == null) || !bool.TryParse(section["aspnet:UseLegacyMachineKeyEncryption"], out _useLegacyMachineKeyEncryption)) { _useLegacyMachineKeyEncryption = false; } if ((section == null) || !bool.TryParse(section["aspnet:AllowRelaxedRelativeUrl"], out _allowRelaxedRelativeUrl)) { _allowRelaxedRelativeUrl = false; } if ((section == null) || !bool.TryParse(section["aspnet:RestrictXmlControls"], out _restrictXmlControls)) { _restrictXmlControls = false; } if ((section == null) || !bool.TryParse(section["aspnet:UseLegacyFormsAuthenticationTicketCompatibility"], out _useLegacyFormsAuthenticationTicketCompatibility)) { _useLegacyFormsAuthenticationTicketCompatibility = false; } if ((section == null) || !bool.TryParse(section["aspnet:AllowRelaxedHttpUserName"], out _allowRelaxedHttpUserName)) { _allowRelaxedHttpUserName = false; } if (((section == null) || !int.TryParse(section["aspnet:MaxHttpCollectionKeys"], out _maxHttpCollectionKeys)) || (_maxHttpCollectionKeys < 0)) { _maxHttpCollectionKeys = 0x3e8; } if (((section == null) || !int.TryParse(section["aspnet:MaxJsonDeserializerMembers"], out _maxJsonDeserializerMembers)) || (_maxJsonDeserializerMembers < 0)) { _maxJsonDeserializerMembers = 0x3e8; } _settingsInitialized = true; } } } } }