如何在基于铬的winForm应用程序C#中设置代理,并使用用户名和密码进行代理?我使用此代码,但不起作用。本质上,我的问题是如何解决它?!
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 System.Net;
using CefSharp.WinForms;
using CefSharp;
using System.Diagnostics;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
Configure();
InitializeComponent();
CreateNewBrowser();
}
public ChromiumWebBrowser browser;
public void Configure()
{
CefSettings cfsettings = new CefSettings();
cfsettings.CefCommandLineArgs.Add("proxy-server",
"socks5://49.140.252.96:1080");
cfsettings.UserAgent = "My/Custom/User-Agent-AndStuff";
Cef.Initialize(cfsettings);
}
public void CreateNewBrowser()
{
browser = new ChromiumWebBrowser("https://whatismyipaddress.com/");
this.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
}
}
}