Exemplo n.º 1
0
        private void CheckExternalLinks(Page page)
        {
            var externalLinks = page.GetExternalLinks();
            foreach (var externalLink in externalLinks)
            {
                try
                {
                    HttpStatusCode httpStatusCode;
                    if (_checkedExternalLinks.ContainsKey(externalLink))
                        httpStatusCode = _checkedExternalLinks[externalLink];
                    else
                    {
                        httpStatusCode = GetHttpStatusCode(externalLink);
                        _checkedExternalLinks.GetOrAdd(externalLink, httpStatusCode);
                    }

                    if (httpStatusCode != HttpStatusCode.OK)
                        Error(externalLink, page.Uri, httpStatusCode);
                }
                catch (Exception exception)
                {
                    Error("Could not get page", exception, externalLink);
                }
            }
        }
 public override void InspectPage(Page page)
 {
     var externalLinks = page.GetExternalLinks();
     foreach (var externalLink in externalLinks)
     {
         if(!_urisToIgnore.Contains(externalLink) && IsInfoEnabled)
             Info($"{externalLink} found on {page.Uri}");
     }
 }