title: How to change Global Windows Proxy using C# .NET with `Immediate Effect`
body: <p>I'm writing a Winform's (C# .NET) app to change Windows' Global (aka Internet Explorer's) proxy settings.</p>
  
  <p>I'm using this.</p>
  
  <pre><code>RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
  registry.SetValue("ProxyEnable", 1);
  registry.SetValue("ProxyServer", "127.0.0.1:8080");
  </code></pre>
  
  <p>But its behaving in a weird manner. I tested this using two browsers</p>
  
  <ul>
  <li><strong>Google Chrome:</strong></li>
  </ul>
  
  <p>When I change/Disable the proxy while Chrome is running. Chrome is still using the previous proxy. The change is not effecting its process. But when I <em>JUST open</em> <code>Internet Options(inetcpl.cpl) &gt; Connections &gt; LAN Settings</code>. The previous change of proxy is now considered. When I said <em>Just open</em> I really mean <em>Just open</em>. I mean, not editing or clicking any other buttons. I guess, its then the global proxy is <strong>really</strong> getting changed (by reading from registry) &amp; Google Chrome is immediately taking the effect.</p>
  
  <ul>
  <li><strong>Internet Explorer 8:</strong></li>
  </ul>
  
  <p>Case with Internet Explorer is much worse. After changing/disabling the proxy using my app while IE is running &amp; Even after going to  "Internet Options(inetcpl.cpl) > Connections > Lan Settings" The running IE proxy isn't getting affected. Not even if I open a new link in a new tab. I had to restart IE for that change to be incorporated.</p>
  
  <p>The behavior I want is that whenever I change proxy settings in my app, all the browsers which are using global proxy (irrespective of whether they are running or not) should <em>instantly</em> incorporate the change in settings.</p>
  
  <p>How can I achieve this?</p>