现在我们可以使用dotnetbrowser捕获http请求并修改请求数据,那么我们是否可以捕获http(s)和ajax响应并像fiddler一样修改它(头部和数据体)?现在我们使用fiddler core和dotnetbrowser来解决这个问题!
发布于 2016-10-24 16:29:32
不幸的是,此功能在当前版本的DotNetBrowser中不可用,但我们正在研究将其添加到下一版本DotNetBrowser中的可能性。
发布于 2018-07-30 17:24:05
当前版本的URL1.16提供了注册自定义协议处理程序的功能,这些处理程序将用于拦截和处理两种标准DotNetBrowser方案(如http、https、ftp等)的所有URL。和在您的应用程序中声明的自定义方案。它允许您根据需要修改URL响应。
注册协议处理程序:
//Registering the handler for the specified protocol
Browser.Context.ProtocolService.Register("https", new HttpsHandler());自定义协议处理程序的实现:
//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));
}
}有关更多信息,可以使用本文:Custom Protocol Handler
https://stackoverflow.com/questions/40189510
复制相似问题