Domanda

I have a C# Winforms application in vs 2012. There is a web client function in my application. I already purchase a private proxy for this application.

But it needs to get credentials before using the private proxy address. How to pass the credentials to the webclient functions?

È stato utile?

Soluzione

Just assign "Proxy" property and it's Credentials property:

var Client = new WebClient();
Client.Proxy = new WebProxy("31.4.5.26", 8080); // proxy's host,port
Client.Proxy.Credentials = new NetworkCredential("proxyuser","proxypassword");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top