简体   繁体   English

如何在 CefSharp 中保存 cookie

[英]How to save cookies in CefSharp

I'm new to CefSharp.我是 CefSharp 的新手。 Last week i build my first little program with CefSharp in C#.上周我用 C# 用 CefSharp 构建了我的第一个小程序。 It's a split screen program.这是一个分屏程序。 In one split i loaded Tweetdeck.在一次拆分中,我加载了 Tweetdeck。 It works fine, but Tweetdeck doesn't store cookies.它工作正常,但 Tweetdeck 不存储 cookie。 Every time i start the program, i must login.每次我启动程序时,我都必须登录。 Is there a way to save the cookies?有没有办法保存cookie?

var browser1 = new CefSharp.WinForms.ChromiumWebBrowser("https://tweetdeck.twitter.com/")
        {
            Dock = DockStyle.Fill,
        };
splitContainer1.Panel1.Controls.Add(browser1);

Set CefSettings.CachePath directory.设置 CefSettings.CachePath 目录。 Settings are passed to Cef.Initialize().设置传递给 Cef.Initialize()。

just on how to use it.只是关于如何使用它。

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            CefSharp.CefSettings settings = new CefSharp.CefSettings();
            settings.CachePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\CEF"; 
           CefSharp.Cef.Initialize(settings);

            InitializeComponent();
            //webcontrol.BrowserSettings.ApplicationCache = CefSharp.CefState.Enabled;

        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM