protected override void Reset(ConfigurationElement parentElement) { if (parentElement != null) { HttpCachePolicyElement http = (HttpCachePolicyElement)parentElement; this.wasReadFromConfig = http.wasReadFromConfig; } base.Reset(parentElement); }
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); } } }