Beispiel #1
0
        public IWebClient GetWebClient(string url)
        {
            IWebClient webClient;

            var uri = new UrlParser(url);
            if (uri.IsDebug)
            {
                webClient = new SandboxWebClient();
            }
            else
            {
                webClient = new HttpWebClient();
            }

            return webClient;
        }
Beispiel #2
0
        public bool UrlIsActive(bool goDown)
        {
            using (var client = new HttpWebClient())
            {
                try
                {
                    var testUrl = goDown
                                      ? client.DownloadString("http://Wrong.xml")
                                      : client.DownloadString("http://pbo-ctmbuild01:8153/go/cctray.xml");

                    client.Dispose();
                    return true;
                }
                catch (Exception)
                {
                    client.Dispose();
                    return false;
                }
            }
        }