How to save cookies in CefSharp

你。 提交于 2019-12-01 00:01:33

问题


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);

回答1:


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




回答2:


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;

        }
    }


来源:https://stackoverflow.com/questions/28419483/how-to-save-cookies-in-cefsharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!