Пример #1
0
        public static bool ExistsOn(this string targetUrl, string sourceUrl)
        {
            try
            {
                var file = new RemoteFile(sourceUrl.ToUri());
                var html = file.GetFileAsString();

                return html.ToUpperInvariant().Contains(targetUrl.ToUpperInvariant());
            }
            catch (WebException)
            {
                return false;
            }
        }
Пример #2
0
        public static bool ExistsOn(this string targetUrl, string sourceUrl, out string title)
        {
            title = string.Empty;
            try
            {
                var file = new RemoteFile(sourceUrl.ToUri());
                var html = file.GetFileAsString();

                title = RegexTitle.Match(html).Value.Trim();
                var containsHtml = RegexHtml.IsMatch(title);

                return html.ToUpperInvariant().Contains(targetUrl.ToUpperInvariant()) && !containsHtml;
            }
            catch (WebException)
            {
                return false;
            }
        }