Is there any way in .NET to programmatically listen to HTTP traffic?

前端 未结 4 1716
借酒劲吻你
借酒劲吻你 2020-12-21 11:26

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

4条回答
  •  时光取名叫无心
    2020-12-21 11:34

    You probably don't want to proxy, that will introduce a lot of unnecessary complexity.

    Consider packet sniffing instead, which is pretty much a solved problem. Wireshark is handy as a stand alone utility you can use manually, but it's also possible to do packet sniffing programmatically, using WinPcap, the library on which Wireshark is based. Here's a couple of examples of WinPcap in .Net, .NetNomad's example with sample project, and a CodeProject tutorial, also with source.

提交回复
热议问题