コード例 #1
0
ファイル: Module.cs プロジェクト: viparek/azure-powershell
 /// <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;
 }
コード例 #2
0
 /// <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();
     }
 }