0

In my .net project, we would like to embed a web browser and be able to read the header responses that are returned when we navigate to a remote website. I was able to do that using CefSharp but since it does not support .Net Core t is off the table.

From what I read I need to create a CefRequst and set a call back to it.

CefRequest request = CefRequest.Create();
request.Url = "https://www.yahoo.com";
request.Method = "GET";

CefUrlRequest cefUrlRequest = _browser.CefBrowser.GetMainFrame().CreateUrlRequest(request, new HeaderRequestClient() );

class HeaderRequestClient : CefUrlRequestClient
{
    protected override void OnDownloadData(CefUrlRequest request, Stream data)
    {
         //throw new NotImplementedException();
    }

    protected override void OnDownloadProgress(CefUrlRequest request, long current, long total)
    {
      // throw new NotImplementedException();
    }

    protected override void OnRequestComplete(CefUrlRequest request)
    {
        //read header
    }

    protected override void OnUploadProgress(CefUrlRequest request, long current, long total)
    {
        //throw new NotImplementedException();
    }
}

The problem is that when I execute this the application crash but gives an error "(0x80000003)" Any idea if I'm on the right track and if so what am I doing wrong?

Itamar Kerbel
  • 2,508
  • 1
  • 22
  • 29
  • 1
    CefSharp will officially support .Net Core very shortly the -pre release packages are available https://www.nuget.org/packages?q=Cefsharp+netcore I expect to create an official release in the next week or so. Windows only. – amaitland Jan 25 '21 at 19:06
  • @amaitland thanks for the tip. I found that in https://github.com/cefsharp/CefSharp.MinimalExample there is a good net core example to start with, but it uses an older version of CefSharp. Can I rely on this example to work with the official version of CefSharp that works with .net core? – Itamar Kerbel Jan 27 '21 at 07:21
  • The https://github.com/cefsharp/CefSharp.MinimalExample/tree/cefsharp/87 branch has been upgraded to use the latest pre release packages. The current net452 packages should still continue to work with net core. – amaitland Jan 27 '21 at 09:13

0 Answers0