if (WebRequest.DefaultWebProxy.GetProxy(new System.Uri("https://www.o-survey.com/")).ToString() == "https://www.o-survey.com/") { MessageBox.Show("A proxy is not in use here"); } else { MessageBox.Show("A proxy is in use here"); } HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.o-survey.com"); IWebProxy proxy = request.Proxy; if (proxy != null) { MessageBox.Show("Proxy: {0}"+ proxy.GetProxy(request.RequestUri)); } else { MessageBox.Show("Proxy: {0}Proxy is null; no proxy will be used"); } WebProxy myProxy = new WebProxy(); Uri newUri = new Uri("http://192.168.1.240:6588"); // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set. myProxy.Address = newUri; // Create a NetworkCredential object and associate it with the // Proxy property of request object. myProxy.Credentials = new NetworkCredential("john", "johngra"); request.Proxy = myProxy;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)