How do I use a socket proxy in C# webbrowser?

后端 未结 2 1148
挽巷
挽巷 2020-12-11 09:00

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#.

2条回答
  •  一个人的身影
    2020-12-11 09:05

    WebBrowser is just an interface over IE. To set the IE proxy settings, you can hack the registry!

            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);
    

提交回复
热议问题