/// <param name="proxy">The HTTP Proxy to use.</param> /// <param name="proxyCredential">The HTTP Proxy Credentials</param> /// <param name="proxyUseDefaultCredentials">True if the proxy should use default credentials</param> public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) { // set the proxy configuration _webProxy.Address = proxy; _webProxy.BypassProxyOnLocal = false; _webProxy.Credentials = proxyCredential?.GetNetworkCredential(); _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials; _handler.UseProxy = proxy != null; }
/// <param name="proxy">The HTTP Proxy to use.</param> /// <param name="proxyCredential">The HTTP Proxy Credentials</param> /// <param name="proxyUseDefaultCredentials">True if the proxy should use default credentials</param> public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) { _useProxy = proxy != null; if (proxy == null) { return; } // set the proxy configuration _webProxy.Address = proxy; _webProxy.BypassProxyOnLocal = false; if (proxyUseDefaultCredentials) { _webProxy.Credentials = null; _webProxy.UseDefaultCredentials = true; } else { _webProxy.UseDefaultCredentials = false; _webProxy.Credentials = proxyCredential?.GetNetworkCredential(); } }