我如何使用C#web浏览器的插座代理?
问题描述:
我怎么点了插座使用的WinForms WebBrowser控件代理IP /端口?随Visual C#.NET标准的Web浏览器。
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.
请在Visual C#.NET帮助。
Please help in Visual C#.NET.
答
WebBrowser控件是只是围绕IE的包装。因此,要设置代理服务器设置,你可以更改注册表键条目。
The WebBrowser control is just a wrapper around IE. So to set proxy settings, you could change the registry key entries.
事情是这样的:
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);