c#cefsharp浏览器尝试设置代理 [英] c# cefsharp browser trying to set proxy
本文介绍了c#cefsharp浏览器尝试设置代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对CefSharp浏览器不太满意,因此我需要一些外部帮助。
I'm not very good with CefSharp browsers so I need some outside help on this.
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);
}
}
}
这是我当前的代码。我希望它使用代理,并且过去3个小时我一直在Google搜索。天色已经晚了,所以我希望有人能帮助我在其中插入代理。
This is my current code. I want it to use a proxy and I have been Googling for the past 3 hours now. It's getting late, so I hope someone can help me insert the proxy in there.
推荐答案
如果您使用的代理类型不同 http,必须在proxy-schema中进行设置,例如如下所示
If you are using a proxy type different "http", you must set it in proxy-schema e.g. as shown following
cfsettings.CefCommandLineArgs.Add("proxy-server", "socks5://200.29.191.149:3128");
您可以在 CEF3文档
这篇关于c#cefsharp浏览器尝试设置代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文