Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save cookies in CefSharp

Tags:

c#

cefsharp

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);
like image 442
NVO Avatar asked Feb 09 '15 21:02

NVO


People also ask

How do I use CefSharp chromium?

To add CefSharp, go to the Solution Explorer on the Top Right of Visual Studio, then right click on your app (under the solution) and select Manage NuGet Packages. When the search menu appears, type cefsharp , select the WinForms distributtion and install it. Follow the installation setup (accept therms and install).


2 Answers

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

like image 181
Czarek Tomczak Avatar answered Sep 18 '22 11:09

Czarek Tomczak


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;

        }
    }
like image 30
shyam_ Avatar answered Sep 19 '22 11:09

shyam_