title: WCF Custom Http Proxy Authentication
body: <p>Is it possible to provide WCF with a custom proxy address and custom credentials? </p>
  
  <p>I've found this answer on stackoverflow: <a href="https://stackoverflow.com/questions/105499/how-to-set-proxy-with-credentials-to-generated-wcf-client">How to set proxy with credentials to generated WCF client?</a>, but I've got a complication, the service I'm authenticating against uses its own authentication, so I've got to use two sets of credentials (one to get through the proxy, and the other to authenticate against the service)</p>
  
  <p>I'm using the technique described in the answers to the other question to provide the service credentials. e.g.</p>
  
  <pre><code>client.ClientCredentials.UserName.UserName = username;
  client.ClientCredentials.UserName.Password = password;
  </code></pre>
  
  <p>I can set the address of the proxy using something like this:</p>
  
  <pre><code>(client.Endpoint.Binding as WSHttpBinding).ProxyAddress = ...;
  </code></pre>
  
  <p>How do I set what is effectively two sets of credentials? (NB: The credentials for the proxy and the actual service are different!) Also note that the proxy details are not necessarily the default system proxy details.</p>