c#cefsharp浏览器尝试设置代理

ned*_*edn 3 c# proxy cefsharp

我对CefSharp浏览器不太满意,因此我需要一些外部帮助。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
using System.Runtime.InteropServices;
using Microsoft.Win32;

 namespace WindowsFormsApplication7
{
    public partial class debug : Form
    {
        public ChromiumWebBrowser browser;

        public debug()
        {
            InitializeComponent();
            InitBrowser();
        }


        private void debug_Load(object sender, EventArgs e)
        {

        }

        public void InitBrowser()
        {
            Cef.Initialize(new CefSettings());
            browser = new ChromiumWebBrowser("https://whatismyipaddress.com/");     
            this.Controls.Add(browser);
            browser.Dock = DockStyle.Fill;
            CefSettings cfsettings = new CefSettings();
            cfsettings.CefCommandLineArgs.Add("proxy-server", "200.29.191.149:3128");
            cfsettings.UserAgent = "My/Custom/User-Agent-AndStuff";
            Cef.Initialize(cfsettings);


        }

    }
}
Run Code Online (Sandbox Code Playgroud)

这是我当前的代码。我希望它使用代理,并且过去3个小时我一直在Google进行搜索。天色已晚,所以我希望有人可以帮助我在其中插入代理。

小智 5

如果您使用的代理类型为不同的“ http”,则必须在proxy-schema中进行设置,例如,如下所示

cfsettings.CefCommandLineArgs.Add("proxy-server", "socks5://200.29.191.149:3128");
Run Code Online (Sandbox Code Playgroud)

您可以在CEF3文档中阅读更多内容