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 var extention = Path.GetExtension(requestParams.RequestUri.AbsoluteUri); if (!string.IsNullOrEmpty(extention)) { for (int i = 0; i < config.Configuration.IgnoreExtentions.Count; i++) { var extentionElm = config.Configuration.IgnoreExtentions[i]; if (string.Equals(extentionElm.Extention, extention, StringComparison.OrdinalIgnoreCase)) { return false; } } } // Check crawler user agent for (int i = 0; i < config.Configuration.Crawlers.Count; i++) { var crawlerElm = config.Configuration.Crawlers[i]; if (crawlerElm.IsMatch(requestParams.UserAgent)) return true; } return false; }
public void Init() { _config = new PrerenderConfig(); _config.Configuration = new PrerenderSection(); }
public WebConfigPrerenderServiceConfiguration(PrerenderConfig config) { _config = config; }