namespace VideoBrowser.Controls.CefSharpBrowser.Helpers { using System; using System.Globalization; using System.Net; /// /// Defines the . /// public static class UrlHelper { #region Methods /// /// The IsImageUrl. /// /// The URL. /// The . public static bool IsImageUrl(this string URL) { if (!(HttpWebRequest.Create(URL) is HttpWebRequest req)) { return false; } req.Method = "HEAD"; try { using (var resp = req.GetResponse()) { return resp.ContentType.ToLower(CultureInfo.InvariantCulture).StartsWith("image/"); } } catch (Exception) { return false; } } #endregion Methods } }