Search code examples
c#cefsharpcefsharp.offscreen

cefsharp DownloadUrlAsync skips Cookie


load url in browser control that require cookie and authentiacaion is ok

  CefSharp.OffScreen.ChromiumWebBrowser browser = new CefSharp.OffScreen.ChromiumWebBrowser(Url, requestContext: reqContext);

but using download url

            var ppp =await browser.GetMainFrame().DownloadUrlAsync(Url);
            var ooop= Encoding.UTF8.GetString(ppp);

redirect to login page and cookie header not sent


Solution

  • This is expected at the moment. It might be possible to add support for sending cookies.

    Try adding the UrlRequestFlags.AllowStoredCredentials flag to the request in DownloadUrlAsync

    A new optional param has been added to allow passing in UrlRequestFlags in version 116.0.150.

    Source