title: Registry not being modified with C# application
body: <p>I have the following snipped of code that is running within a Windows Service.</p>
  <p>The service watches the LAN and changes the proxy settings accordingly, the problem is that for some reason the proxy settings are not being updated.</p>
  <p>The application is running under the Local System Account but the registry stil ldoes nto change:</p>
  <p>Anyone have any ideas?</p>
  <pre><code>using (var key = Registry.CurrentUser.OpenSubKey(@&quot;Software\Microsoft\Windows\CurrentVersion\Internet Settings&quot;, true))
  {
      if (key != null)
      {
          key.SetValue(&quot;ProxyEnable&quot;, Convert.ToInt32(enable), RegistryValueKind.DWord);
  
          //I/O Flushes
          key.Flush();
          key.Close();
          return;
      }
  
      //Exception thrown here to test if key is valid.
  }
  </code></pre>