0

Now we can use dotnetbrowser catch http request and modify the request data, so can we catch http(s) and ajax response and modify it (both header and data body) like fiddler? for now we use fiddler core and dotnetbrowser to deal this question!

lsl
  • 19
  • 3

2 Answers2

0

Unfortunately, this functionality is not available in the current version of DotNetBrowser, but we are investigating the possibility to add it to the next version of DotNetBrowser.

Anna Dolbina
  • 1
  • 1
  • 8
  • 9
0

The current version of DotNetBrowser 1.16 provides an ability to register custom protocol handlers that will be used to intercept and handle all the URL requests for both standard URL schemes (such as http, https, ftp, etc.) and custom schemes declared in your application. It allows modifying URL responses as you need.

Registering a protocol handler:

//Registering the handler for the specified protocol
Browser.Context.ProtocolService.Register("https", new HttpsHandler());

Implementation of a custom protocol handler:

//The instance of this type will handle the requests of the specified protocol
public class HttpsHandler : IProtocolHandler
{
    //This method should provide the response for the specified request
    public IUrlResponse Handle(IUrlRequest request)
    {
        string htmlContent = "Request Url: " + request.Url + "\n";
        return new UrlResponse(Encoding.UTF8.GetBytes(htmlContent));
    }
}

For more information, you can use this article: Custom Protocol Handler

Vladyslav Tsvek
  • 244
  • 1
  • 10