Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using WebView2 in WPF control to host the new edge.

In my code, I want to cache the cookie and browser specific data to a cache directory. The cache location should be set in the CoreWebView2EnvironmentOptions when creating the CoreWebView2Environment.

Is there any way we can achieve this ? Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

I have made a WPF application using WebView2 that sets the cache directory to user appdata folder. Below is a snippet of the code from my application.

var webView2Environment = await CoreWebView2Environment.CreateAsync(null, _cacheFolderPath);
await kioskBrowser.EnsureCoreWebView2Async(webView2Environment);

kioskBrowser.Source = new Uri(url);

You can find the rest of the code here KioskBrowser (GitHub)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...