public static bool IsRequestShouldBePrerendered(RequestParams requestParams, PrerenderConfig config) { // Check '_escaped_fragment_' query string parameter if (!string.IsNullOrEmpty(requestParams.RequestUri.Query) && requestParams.RequestUri.Query.Contains(EscapedQueryStringParameterName)) { return(true); } // Check ignore file extentions string extention = Path.GetExtension(requestParams.RequestUri.AbsoluteUri); if (!string.IsNullOrEmpty(extention)) { for (int i = 0; i < config.Configuration.IgnoreExtentions.Count; i++) { PrerenderSection.IgnoreExtentionElement extentionElm = config.Configuration.IgnoreExtentions[i]; if (string.Equals(extentionElm.Extention, extention, StringComparison.OrdinalIgnoreCase)) { return(false); } } } // Check crawler user agent if (requestParams.UserAgent != null) { for (int i = 0; i < config.Configuration.Crawlers.Count; i++) { PrerenderSection.CrawlerElement crawlerElm = config.Configuration.Crawlers[i]; if (crawlerElm.IsMatch(requestParams.UserAgent)) { return(true); } } } return(false); }
public PrerenderServiceConfiguration() : this(PrerenderConfig.GetCurrent()) { }
public PrerenderServiceConfiguration(PrerenderConfig config) { _config = config; }
public void Init() { _config = new PrerenderConfig(); _config.Configuration = new PrerenderSection(); }