Readering resposnse headers with CefGlue

114 views Asked by At

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?

0

There are 0 answers