.NET 中有没有办法以编程方式侦听 HTTP 流量? [英] Is there any way in .NET to programmatically listen to HTTP traffic?

查看:34
本文介绍了.NET 中有没有办法以编程方式侦听 HTTP 流量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用浏览器自动化来测试网站,但我需要验证来自浏览器的 HTTP 请求(即图像、外部脚本、XmlHttpRequest 对象).有没有办法以编程方式实例化一个代理或数据包嗅探器供浏览器使用,以便查看它发送的内容?

I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy or packet sniffer for the browser to use in order to see what its sending?

我已经在使用 Fiddler 来观察流量,但我想要一些可以在持续构建集成中使用的无 UI 的东西.

I'm already using Fiddler to watch the traffic but I want something that's UI-less that I can use in continuous build integration.

我可以从 WinpCap 轻松获取特定于 HTTP 的信息吗?

Can I easily get the HTTP-specific information from WinpCap?

推荐答案

试试 winpcap .它是一个驱动程序/库组合,可用于监控数据包.根据您尝试执行的操作(在没有 UI 的情况下观看流量),这可能是比编写自己的代理更简单的解决方案.

Try winpcap . It's a driver/library combination which can be used to monitor packets. Based on what you are trying to do (watch traffic w/o a UI), this is probably a simpler solution than writing your own proxy.

这篇关于.NET 中有没有办法以编程方式侦听 HTTP 流量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆