Is it possible to provide WCF with a custom proxy address and custom credentials?
I've found this answer on stackoverflow: How to set proxy with credentials to generated WCF client?, 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)
I'm using the technique described in the answers to the other question to provide the service credentials. e.g.
client.ClientCredentials.UserName.UserName = username;
client.ClientCredentials.UserName.Password = password;
I can set the address of the proxy using something like this:
(client.Endpoint.Binding as WSHttpBinding).ProxyAddress = ...;
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.