Answer the question
In order to leave comments, you need to log in
C#. Your proxy server with authorization. Are there simple solutions?
Hello. I need to add an http proxy like "localhost:port" to my application. The proxy should simply redirect all requests to an external proxy with authorization like "user:[email protected]:port" and send the received response to the browser. That is, in fact, you need a proxy authorizer. Is there any easier way to add this functionality to my solution?
Answer the question
In order to leave comments, you need to log in
WebProxy proxy = new WebProxy();
proxy.Address = new Uri("mywebproxyserver.com");
proxy.Credentials = new NetworkCredential("usernameHere", "pa****rdHere"); //These can be replaced by user input
proxy.UseDefaultCredentials = false;
proxy.BypassProxyOnLocal = false; //still use the proxy for local addresses
WebClient client = new WebClient();
client.Proxy = proxy;
string doc = client.DownloadString("http://www.google.com/");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question