سؤال

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