Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.

By default, each Browser instance stores all user data such as history, cookies, cache on disk. Since 1.14 you can configure Browser instance to store all user data in memory (Chromium's "Incognito" mode), so that all user data will be cleared once your .Net application is terminated.

The following example demonstrates how to configure Browser instance to work in "Incognito" mode and store all user data in memory:


using System.Windows.Forms;
using DotNetBrowser;
using DotNetBrowser.WinForms;

namespace WindowsFormsApplication9
    public partial class Form1 : Form
        public Form1()
            BrowserContextParams parameters = new BrowserContextParams("data-dir") { StorageType = StorageType.MEMORY };
            BrowserContext context = new BrowserContext(parameters);
            Browser browser = BrowserFactory.Create(context);
            WinFormsBrowserView browserView = new WinFormsBrowserView(browser);



Imports DotNetBrowser
Imports DotNetBrowser.WinForms

Public Class Form1

    Sub New()
        Dim parameters As BrowserContextParams = New BrowserContextParams("data-dir") With {.StorageType = StorageType.MEMORY}
        Dim context As BrowserContext = New BrowserContext(parameters)
        Dim browser As Browser = BrowserFactory.Create(context)
        Dim browserView As WinFormsBrowserView = New WinFormsBrowserView(browser)

    End Sub
End Class