Note that there are some explanatory texts on larger screens.

plurals
  1. PODefault Proxy IE
    text
    copied!<p>How to set the default proxy for Internet Explorer in C# .net?<br/></p> <p>I wanna make a browser capable of searching for a valid proxy in a .txt file and using it.<br/> The IP and Port used with the set default proxy command are valid however, the command itself does absolutely nothing. <br/><br/> The only way I've found to use a proxy with a VS2013 .net browser is by adding it manually to IE which is incredibly useless.<br/></p> <pre><code>class Proxy { List&lt;string&gt; Proxy_IP; List&lt;int&gt; Proxy_Port; public Proxy() { Proxy_IP = new List&lt;string&gt;(); Proxy_Port = new List&lt;int&gt;(); populateProxyList(); } public void findProxy() { for (sbyte i = 0; i &lt; Proxy_IP.Count; i++) { string IP = Proxy_IP[i]; int Port = Proxy_Port[i]; if (isValid(IP, Port)) { setDefaultProxy(IP, Port); break; } } } private void populateProxyList() { string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Public\Proxies.txt"); foreach (string line in lines) { int endIP = line.IndexOf('#'); int startPort = endIP + 1; int portLength = line.Length - (endIP + 2); string IP = line.Remove(endIP); int Port = Convert.ToInt32(line.Substring(startPort, portLength)); Proxy_IP.Add(IP); Proxy_Port.Add(Port); } } private void setDefaultProxy(string ip, int port) { System.Windows.Forms.MessageBox.Show(ip + ":" + port.ToString()); // Proxy is valid System.Net.WebRequest.DefaultWebProxy = new WebProxy(ip, port); // Doesn't do shit } private bool isValid(string IP, int Port) { bool pingable = false; Ping pinger = new Ping(); try { PingReply reply = pinger.Send(IP); pingable = reply.Status == IPStatus.Success; } catch (PingException) { } return pingable; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload