Reputation: 1
So I've previously asked this question:
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.
Please help in Visual C#.NET.
I got a response telling me that "WebBrowser is just an interface over IE. To set the IE proxy settings, you can hack the registry!"
He told me to add the following code:
string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
string serverName = "";//your proxy server name;
string port = ""; //your proxy port;
string proxy = serverName + ":" + port;
RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);
RegKey.SetValue("ProxyServer", proxy);
RegKey.SetValue("ProxyEnable", 1);
Of course, this might be added to something like a button clicked event, and I would need to add in the proxy and port.
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.
I'm assuming I'm missing a using directive for both of those, but I don't know.
How do I fix this problem in Visual C#.NET?
Upvotes: 1
Views: 3890
Reputation: 35477
As I commented in the previous question.
using Microsoft.Win32;
See http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey(v=VS.80).aspx
Upvotes: 4