CefSharp如何存储Cookie [英] CefSharp how to store cookies
本文介绍了CefSharp如何存储Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法将Cookie保存在CefSharp中。
这是我尝试的操作:
CefSettings设置= new CefSettings();
字符串路径= Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Cef.Initialize(new CefSettings());
settings.RemoteDebuggingPort = 8088;
settings.CachePath =路径;
我使用台式机只是为了对其进行测试,但我也尝试了其他方法。
这是其他人无法解决的解决方案:
设置 CefSettings.CachePath
目录。设置将传递到 Cef.Initialize()
。答案来自此处。 p>
在评论之后,我尝试了以下操作:
在初始化部分中,我将其放置了
CefSettings设置= new CefSettings();
字符串路径= Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
settings.RemoteDebuggingPort = 8088;
settings.CachePath =路径;
Cef.Initialize(new CefSettings());
和
private void Form1_Load(对象发送者,EventArgs e)
{
SearchBox.Text = http://www.google.com/;
chrome =新的ChromiumWebBrowser(SearchBox.Text);
this.MainBrowser.Controls.Add(chrome);
chrome.Dock = DockStyle.Fill;
chrome.AddressChanged + = Chrome_AddressChanged;
解决方案
私人无效InitializeChromium()
{
CefSettings settings = new CefSettings();
字符串路径= Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
settings.RemoteDebuggingPort = 8080;
settings.CachePath =路径;
//使用提供的设置初始化Cef
Cef.Initialize(settings);
//创建浏览器组件
chrome = new ChromiumWebBrowser(SearchBox.Text);
//将浏览器添加到
形式this.MainBrowser.Controls.Add(chrome);
//使浏览器填写表格
chrome.Dock = DockStyle.Fill;
}
I can't get cookies to save in CefSharp.
Here is what I tried:
CefSettings settings = new CefSettings();
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Cef.Initialize(new CefSettings());
settings.RemoteDebuggingPort = 8088;
settings.CachePath = path;
I'm using the desktop just to test it but I tried others as well.
This is the solution others got but I can't get it to work:
Set CefSettings.CachePath
directory. Settings are passed to Cef.Initialize()
. The answer was from here.
After the comments I have tried this:
In the Initialize part I put this
CefSettings settings = new CefSettings();
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
settings.RemoteDebuggingPort = 8088;
settings.CachePath = path;
Cef.Initialize(new CefSettings());
and
private void Form1_Load(object sender, EventArgs e)
{
SearchBox.Text = "http://www.google.com/";
chrome = new ChromiumWebBrowser(SearchBox.Text);
this.MainBrowser.Controls.Add(chrome);
chrome.Dock = DockStyle.Fill;
chrome.AddressChanged += Chrome_AddressChanged;
解决方案
private void InitializeChromium()
{
CefSettings settings = new CefSettings();
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
settings.RemoteDebuggingPort = 8080;
settings.CachePath = path;
//Initialize Cef with the provided settings
Cef.Initialize(settings);
//Create a browser component
chrome = new ChromiumWebBrowser(SearchBox.Text);
//Add he browser to the form
this.MainBrowser.Controls.Add(chrome);
//Make the browser fill the form
chrome.Dock = DockStyle.Fill;
}
这篇关于CefSharp如何存储Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文