title: How do I access Registry from C# for a proxy?
body: <p>So I've previously asked this question:</p>
  <blockquote>
  <p>How do I point a socket to the proxy ip/port using the winforms webbrowser control? The
  standard web browser that comes with Visual C#.NET.</p>
  <p>Please help in Visual C#.NET.</p>
  </blockquote>
  <p>I got a response telling me that &quot;WebBrowser is just an interface over IE. To set the IE proxy settings, you can hack the registry!&quot;</p>
  <p>He told me to add the following code:</p>
  <pre><code>    string key = &quot;Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&quot;;
      string serverName = &quot;&quot;;//your proxy server name;
      string port = &quot;&quot;; //your proxy port;
      string proxy = serverName + &quot;:&quot; + port;
  
      RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);
      RegKey.SetValue(&quot;ProxyServer&quot;, proxy);
      RegKey.SetValue(&quot;ProxyEnable&quot;, 1);
  </code></pre>
  <p>Of course, this might be added to something like a button clicked event, and I would need to add in the proxy and port.</p>
  <p>The problem is that RegistryKey could not be found because I'm either missing a using directive or an assembly reference, and Registry does not exist in the current context.</p>
  <p>I'm assuming I'm missing a using directive for both of those, but I don't know.</p>
  <p>How do I fix this problem in Visual C#.NET?</p>