question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cookies read/write not working in WebView on WinUI

See original GitHub issue

Description

Reading or writing Cookies (see docs) are not working on WinUI. I think this is because the WebViewRenderer uses the “old” HttpBaseProtocolFilter approach to read/write cookies to the underlying WebView2 control, which does not work. The new approach should be used: https://github.com/MicrosoftEdge/WebView2Feedback/blob/master/specs/CookieManagement.md

Steps to Reproduce

See https://github.com/dotnet/maui/blob/main/src/Compatibility/Core/src/Windows/WebViewRenderer.cs#L255

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

10.0.19041

Did you find any workaround?

I’m using a custom HybridWebView where I (partially) implemented the new solution. See https://github.com/devsmadeofsteel/Plugin.HybridWebView/pull/17

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
degenetcommented, Jun 27, 2022

I see that we merged a PR that uses the CookieManager: https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs#L169

Could someone confirm that this is still an issue with the latest release (6.0.400, released yesterday at the time of writing)

I can confirm this issue is still present.

0reactions
msftbot[bot]commented, Aug 30, 2022

We’ve moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WinUI3 Adding cookie in webview2 not working
I wrote the following code of WinUI 3. This code aims to set a cookie using CoreWebView2.CookieManager.AddOrUpdateCookie(Cookie) but the cookie ...
Read more >
How do you clear all cookies before loading a site using ...
It might be caused by the same reason in Cookies read/write not working in WebView on WinUI #3901 For this, you could try...
Read more >
Manage user data folders - Microsoft Edge Development
A folder that WebView2 creates to store browser data, such as cookies, permissions, and cached resources. UDF, The user data folder. UDF ...
Read more >
Going Native with Blazor
Blazor is welcome on mobile/desktop apps with .NET MAUI, and can pull off some pretty native functionality with platform API access.
Read more >
Enable cookies on PhoneGap Android App
i have a problem when running my app on android devices. The cookies are not enabled on the webview (running it on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found