How to save cookies in CefSharp

2019-02-16 20:46发布

I'm new to CefSharp. Last week i build my first little program with CefSharp in C#. It's a split screen program. In one split i loaded Tweetdeck. It works fine, but Tweetdeck doesn't store cookies. Every time i start the program, i must login. Is there a way to save the cookies?

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

标签: c# CefSharp
2条回答
叼着烟拽天下
2楼-- · 2019-02-16 21:27

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;

        }
    }
查看更多
Emotional °昔
3楼-- · 2019-02-16 21:32

Set CefSettings.CachePath directory. Settings are passed to Cef.Initialize().

查看更多
登录 后发表回答