DOTNETIDS.WebScanRunner.Run C# (CSharp) Méthode

Run() public méthode

public Run ( ) : void
Résultat void
        public void Run()
        {
            //Determine if we already have a Page Settings object
            IDSPageSettings ips;

            _settings.PageSettings.TryGetValue(Misc.GetCurrentPageName(), out ips);

            if (ips == null)
            {
                ips = new IDSPageSettings(_settings);
                _settings.PageSettings.Add(Misc.GetCurrentPageName(), ips);
            }

            //Wire up the web.config page callbacks
            foreach (IDSCallback callback in ips.Callbacks)
            {
                Type t = Misc.ResolveType(callback.Assembly, callback.Namespaceandcallback);
                SetupBinding(t, callback.Method);
            }
            
            if (ips.OnIDSEvent != null)
            {
                foreach (Delegate d in ips.OnIDSEvent.GetInvocationList())
                {
                    OnIDSEvents += (IDSEvent)d;
                }
            }

            //Wire up the web.config global callbacks
            foreach (IDSCallback callback in _settings.Callbacks)
            {
                Type t = Misc.ResolveType(callback.Assembly, callback.Namespaceandcallback);
                SetupBinding(t, callback.Method);
            }

            //If _callScan is false then the firing mechanism will run in
            //the page_preinit event of a page/page subclass
            if (!_callScan) return;

            RunScan(ips);
        }

Usage Example

        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();
        }
All Usage Examples Of DOTNETIDS.WebScanRunner::Run