title: How to set proxy credentials to specific wcf client?
body: <p>I need to connect to some public wcf service, but there is some proxy between me and service.
  If i use default proxy settings such as</p>
  
  <pre><code>&lt;system.net&gt;
    &lt;defaultProxy useDefaultCredentials="true" /&gt;
  &lt;/system.net&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>HttpWebRequest.DefaultWebProxy
  </code></pre>
  
  <p>it works perfectly fine
  but i don't need to set proxy settings for entire application, i need to set it for specific connection. So how I can do that?</p>
  
  <p>I saw ProxyAddress property </p>
  
  <pre><code>(client.Endpoint.Binding as BasicHttpBinding).ProxyAddress
  </code></pre>
  
  <p>but there is no any properties for credentials...
  I was thinking to somehow modify HttpWebRequest, but I do not know how to get it...</p>
  
  <p><strong>Solved</strong></p>
  
  <p>Thank you all for your answers.</p>
  
  <p>Answer of AntonK suitable for solving my problem.</p>
  
  <p>At the time when this question was actual, I solved it in the same way, but without the use of web.config and wrote this method</p>
  
  <pre><code>void SetProxySettings&lt;TChannel&gt;(ClientBase&lt;TChannel&gt; client, 
      bool useProxy, string address, int port, string login, string password) 
      where TChannel : class
  {
      if (!useProxy) return;
      var b = client.Endpoint.Binding as BasicHttpBinding;
      if (b == null)
      {
          System.Diagnostics.Debug.WriteLine("Binding of this endpoint is not BasicHttpBinding");
          return;
      }
      b.ProxyAddress = new Uri(string.Format("http://{0}:{1}", address, port));
      b.UseDefaultWebProxy = false; // !!!
      b.Security.Mode = BasicHttpSecurityMode.Transport;
      b.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; // !!!
      b.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; // !!!
      if (client.ClientCredentials == null) return;
      client.ClientCredentials.UserName.UserName = login;
      client.ClientCredentials.UserName.Password = password;
  }
  </code></pre>