internal static RequestCachingSectionInternal GetSection() { RequestCachingSectionInternal internal2; lock (ClassSyncObject) { RequestCachingSection section = System.Configuration.PrivilegedConfigurationManager.GetSection(ConfigurationStrings.RequestCachingSectionPath) as RequestCachingSection; if (section == null) { internal2 = null; } else { try { internal2 = new RequestCachingSectionInternal(section); } catch (Exception exception) { if (NclUtilities.IsFatal(exception)) { throw; } throw new ConfigurationErrorsException(System.SR.GetString("net_config_requestcaching"), exception); } } } return(internal2); }
static internal RequestCachingSectionInternal GetSection() { lock (RequestCachingSectionInternal.ClassSyncObject) { RequestCachingSection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.RequestCachingSectionPath) as RequestCachingSection; if (section == null) { return(null); } try { return(new RequestCachingSectionInternal(section)); } catch (Exception exception) { if (NclUtilities.IsFatal(exception)) { throw; } throw new ConfigurationErrorsException(SR.GetString(SR.net_config_requestcaching), exception); } catch { throw new ConfigurationErrorsException(SR.GetString(SR.net_config_requestcaching), new Exception(SR.GetString(SR.net_nonClsCompliantException))); } } }
internal RequestCachingSectionInternal(RequestCachingSection section) { this.httpRequestCacheValidator = new HttpRequestCacheValidator(false, this.UnspecifiedMaximumAge); this.disableAllCaching = true; FtpCachePolicyElement ftpPolicy = section.DefaultFtpCachePolicy; if (ftpPolicy.WasReadFromConfig) { this.defaultFtpCachePolicy = new RequestCachePolicy(ftpPolicy.PolicyLevel); } }
internal RequestCachingSectionInternal(RequestCachingSection section) { if (!section.DisableAllCaching) { this.defaultCachePolicy = new RequestCachePolicy(section.DefaultPolicyLevel); this.isPrivateCache = section.IsPrivateCache; this.unspecifiedMaximumAge = section.UnspecifiedMaximumAge; } else { this.disableAllCaching = true; } this.httpRequestCacheValidator = new HttpRequestCacheValidator(false, this.UnspecifiedMaximumAge); this.ftpRequestCacheValidator = new FtpRequestCacheValidator(false, this.UnspecifiedMaximumAge); this.defaultCache = new WinInetCache(this.IsPrivateCache, true, true); if (!section.DisableAllCaching) { HttpCachePolicyElement defaultHttpCachePolicy = section.DefaultHttpCachePolicy; if (defaultHttpCachePolicy.WasReadFromConfig) { if (defaultHttpCachePolicy.PolicyLevel == HttpRequestCacheLevel.Default) { HttpCacheAgeControl cacheAgeControl = (defaultHttpCachePolicy.MinimumFresh != TimeSpan.MinValue) ? HttpCacheAgeControl.MaxAgeAndMinFresh : HttpCacheAgeControl.MaxAgeAndMaxStale; this.defaultHttpCachePolicy = new HttpRequestCachePolicy(cacheAgeControl, defaultHttpCachePolicy.MaximumAge, (defaultHttpCachePolicy.MinimumFresh != TimeSpan.MinValue) ? defaultHttpCachePolicy.MinimumFresh : defaultHttpCachePolicy.MaximumStale); } else { this.defaultHttpCachePolicy = new HttpRequestCachePolicy(defaultHttpCachePolicy.PolicyLevel); } } FtpCachePolicyElement defaultFtpCachePolicy = section.DefaultFtpCachePolicy; if (defaultFtpCachePolicy.WasReadFromConfig) { this.defaultFtpCachePolicy = new RequestCachePolicy(defaultFtpCachePolicy.PolicyLevel); } } }