private bool ExcludeRequest() { ExcludeRobotsArgs args = new ExcludeRobotsArgs(); ExcludeRobotsPipeline.Run(args); return(args.IsInExcludeList); }
public override void Process(ExcludeRobotsArgs args) { Assert.ArgumentNotNull(args, nameof(args)); if (!this.ShouldExecute()) { return; } var request = this.HttpContext?.Request; args.IsInExcludeList = this.CheckUserAgent(request); }
public override void Process(ExcludeRobotsArgs args) { HttpCookie cookieConsentCookie = args.Request.Cookies.Get(Settings.GetSetting("Analytics.CookieConsentCookie")); if (cookieConsentCookie == null || cookieConsentCookie.Value != Settings.GetSetting("Analytics.CookieConsentValue")) { args.IsRequestExcluded = true; //Overwrite the Sitecore Analytics cookies with a //new cookie that expires in the past which will //result in them being removed from the client foreach (string key in args.Request.Cookies.AllKeys.Where(key => key.StartsWith(COOKIE_PREFIX))) { HttpContext.Current.Response.Cookies.Add(new HttpCookie(key) { Expires = DateTime.Now.AddDays(-1) }); } } }