mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
The ability to set cookies via Cookies GetAsync has disappeared. #1042
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @S-tokarev on GitHub (Dec 22, 2025).
In the previous version, I used this method for setting cookies:
var cookies = await window.WebContents.Session.Cookies.GetAsync(new CookieFilter());In this version, I didn't see direct access to interacting with cookies. There's no documentation on
Session, and in the code, I only seeOnChanged, notGet/Set.How can I set cookies in
WebContentsnow, and will this be included in future versions? thx@AeonSake commented on GitHub (Dec 22, 2025):
While there currently is no direct API on the C# side, you can always just invoke setting the cookies on the JS side via a JS call:
Or with a helper/extension method like this:
There is probably a much better way to do this while utilizing the
Cookieclass that already exists inElectronNET.API.Entities(including proper serialization/deserialization of all possible cookie properties), and probably also needs another method to retrieve cookies or a specific cookie. But until that is implemented, this approach should work fine.@FlorianRappl commented on GitHub (Dec 22, 2025):
I am actually unsure why this was removed (I think it was just an oversight - seemed to have happened with the transition to ElectronNET.Core).
I am trying to re-add the API currently. Should be available in 0.4.1.
@FlorianRappl commented on GitHub (Dec 23, 2025):
Part of most recent preview (0.4.1-pre.23).