Fetch cookies from WebView2 Edge website login for WinInet/WinHTTP crawl

Viewed 334

Suppose I am using WinInet/WinHTTP for crawling a website. In the past I could simply ask a user to login to a website using either embedded IE control or the IE browser and WinInet would use the same cookies as the IE browser. Now that will not anymore as the Internet Explorer is getting old and removed very soon.

For whatever reason Edge browser does not wrap/use the Windows Internet settings / cookies storage... Does anyone have experience login through an embedded webview2 ... fetch cookes and transfer to WinInet? For purpose being here that you can use WinInet/WinHTTP to crawl the website in login'ed state.

Is it a feasible solution login through embedded WebView2 control and transfer all cookies to WinInet before issuing WinInet HTTP requests?

(I have added a Delphi specific tag (TEdgeBrowser) but I am intersted in hearing if the above described concept in general can be brought to work.)

1 Answers

We added a CoreWebView2.CookieManager to WebView2 so you should be able to enumerate all cookies in WebView2 and set them on to wininet or vice versa. WebView2 and Edge is based on chromium and has its own HTTP stack and state location so is not connected to wininet.

Related