public static void SetHttpProxy(string host, string port, string username, string password) { ICredentials cred; cred = new NetworkCredential(username, password); if (!string.IsNullOrEmpty(host)) { _webproxy = new WebProxy(host + ":" + port ?? "80", true, null, cred); } }