/// <summary> /// This is to ignore non-user based requests /// e.g., /_services/ /setup/ /_resources/ /xrm/js/ /// </summary> /// <returns>true if valid path; otherwise false</returns> public static bool IsTelemetryEnabledRequestPath() { if (!TelemetryState.HasRequestContext) { return(false); } var path = HttpContext.Current.Request.Path; return(!TelemetryState.IsPathMatch(path)); }
/// <summary> /// This is to ignore non-page requests /// Wil check the path and the referrer's path to determine if the page request came from a valid path /// </summary> /// <returns>true if valid path; otherwise false</returns> public static bool IsTelemetryEnabledRequestPage() { if (!TelemetryState.HasRequestContext) { return(false); } Uri referrer = null; if ((referrer = HttpContext.Current.Request.UrlReferrer) == null) { return(TelemetryState.IsTelemetryEnabledRequestPath()); } return(!TelemetryState.IsPathMatch(referrer.AbsolutePath)); }