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?

有帮助吗?

解决方案

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");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top