如何使用winforms webbrowser控件将套接字指向代理IP /端口? Visual C#.NET附带的标准Web浏览器。如何在C#webbrowser中使用套接字代理?
请帮助在Visual C#.NET中。
如何使用winforms webbrowser控件将套接字指向代理IP /端口? Visual C#.NET附带的标准Web浏览器。如何在C#webbrowser中使用套接字代理?
请帮助在Visual C#.NET中。
WebBrowser控件只是IE的一个包装。因此,要设置代理设置,您可以更改注册表项条目。
事情是这样的:
string serverName = ""; // your proxy server name
string port = ""; // your proxy port
var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
key.SetValue("ProxyServer", serverName + ":" + port);
key.SetValue("ProxyEnable", 1);
web浏览器只是在IE浏览器的接口。要设置IE代理设置,你可以破解注册表!
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);
我认为有一些缺失...... RegistryKey告诉我,它不存在于当前的上下文中,我可能会缺少使用指令或程序集引用。怎么了? – Alper 2011-06-06 02:28:38
@Jacob - 'using Microsoft.Win32;' – 2011-06-06 02:47:58