void ids_BeginRequest(object sender, EventArgs e) { //Attempt to read the app's config IDSGlobalSettings ims = (IDSGlobalSettings)ConfigurationSettings.GetConfig("dotnetids/idsconfig"); string filename = System.IO.Path.GetFileName(HttpContext.Current.Request.Url.AbsolutePath).ToLowerInvariant(); //Look for regex options to exclude foreach (RegexSettings rs in ims.ExcludedRegexen) { RegexOptions ro = new RegexOptions(); if (rs.IgnoreCase) { ro = ro | RegexOptions.IgnoreCase; } if (Regex.IsMatch(HttpContext.Current.Request.Url.AbsolutePath, rs.Pattern, ro)) return; } //Look for pages to exclude foreach (string s in ims.ExcludedPages) { if (s.ToLowerInvariant() == filename) return; } //Run the scanner WebScanRunner sr = new WebScanRunner(ims); sr.Run(); }
/// <summary> /// The Secure Page's OnInit event handler /// </summary> /// <param name="e">The Page Init EventArgs</param> protected override void OnInit(EventArgs e) { base.OnInit(e); //Create a config object IDSGlobalSettings settings = new IDSGlobalSettings(); IDSPageSettings pageSettings = new IDSPageSettings(settings); pageSettings.OnIDSEvent = OnIDSEvent; pageSettings.CookieExclusions = _exclusions_cookies; pageSettings.PostExclusions = _exclusions_post; pageSettings.HeaderExclusions = _exclusions_headers; pageSettings.GetExclusions = _exclusions_get; pageSettings.DecodeJS = _decodeJS; pageSettings.DecodeUTF7 = _decodeUTF7; settings.PageSettings.Add(Misc.GetCurrentPageName(), pageSettings); WebScanRunner wsr = new WebScanRunner(settings); wsr.Run(); }
void ids_BeginRequest(object sender, EventArgs e) { //Attempt to read the app's config IDSGlobalSettings ims = (IDSGlobalSettings)ConfigurationSettings.GetConfig("dotnetids/idsconfig"); string filename = System.IO.Path.GetFileName(HttpContext.Current.Request.Url.AbsolutePath).ToLowerInvariant(); //Look for regex options to exclude foreach (RegexSettings rs in ims.ExcludedRegexen) { RegexOptions ro = new RegexOptions(); if (rs.IgnoreCase) { ro = ro | RegexOptions.IgnoreCase; } if (Regex.IsMatch(HttpContext.Current.Request.Url.AbsolutePath, rs.Pattern, ro)) { return; } } //Look for pages to exclude foreach (string s in ims.ExcludedPages) { if (s.ToLowerInvariant() == filename) { return; } } //Run the scanner WebScanRunner sr = new WebScanRunner(ims); sr.Run(); }