Setting BrowserWindow Cookies to a value that should be or is URL encoded fails #688

Open
opened 2026-01-29 16:46:05 +00:00 by claunia · 0 comments
Owner

Originally created by @ppostman on GitHub (Aug 6, 2021).

Electron.NET v13.5.1

I'm using BrowserWindow.WebContents.Session.Cookies.SetAsync(CookieDetails) and most cookies are being set properly, but if I have a value that contains a URL for example, the method will fail whether I URL encode the value or not. This also occurs for values that contain semi colons.

Example: Setting a _landing_page cookie to a value of /2192362/checkouts/4bba0ebb64be7d014ae86bc1fe2ffb39

I have tried setting the cookie value in plain text and as an encoded value as such,

parsing checkpoint cookie _landing_page: /2192362/checkouts/3e34bad9e08e141d659830a21736b97f
parsing checkpoint cookie _landing_page: %2f2192362%2fcheckouts%2f4bba0ebb64be7d014ae86bc1fe2ffb39

Each attempt error's and halts the thread, even when placed into a try catch.

Perhaps I'm missing something in the way I'm supposed to be encoding the values or setting the cookie, any insight would be appreciated.

Originally created by @ppostman on GitHub (Aug 6, 2021). **Electron.NET v13.5.1** I'm using BrowserWindow.WebContents.Session.Cookies.SetAsync(CookieDetails) and most cookies are being set properly, but if I have a value that contains a URL for example, the method will fail whether I URL encode the value or not. This also occurs for values that contain semi colons. Example: Setting a _landing_page cookie to a value of /2192362/checkouts/4bba0ebb64be7d014ae86bc1fe2ffb39 I have tried setting the cookie value in plain text and as an encoded value as such, parsing checkpoint cookie _landing_page: /2192362/checkouts/3e34bad9e08e141d659830a21736b97f parsing checkpoint cookie _landing_page: %2f2192362%2fcheckouts%2f4bba0ebb64be7d014ae86bc1fe2ffb39 Each attempt error's and halts the thread, even when placed into a try catch. Perhaps I'm missing something in the way I'm supposed to be encoding the values or setting the cookie, any insight would be appreciated.
claunia added the bug label 2026-01-29 16:46:05 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#688