How to capture HTTP response with C#?

≯℡__Kan透↙ 提交于 2019-12-25 03:06:50

问题


How do I capture HTTP response when the request is made by web browser?

Webpage retrieves data (with post) from a service. Service returns a json object. What I want is to capture that json and parse it in realtime.

What would be the simplest way to do it?


回答1:


Your best bet is to use Fiddler, perhaps with the JSON viewer add-on.

From the homepage:

Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.




回答2:


Try googling for HttpModule in .Net. They are some sort of filters. HTTP requests and responses flow through them and can manipulate the content.



来源:https://stackoverflow.com/questions/2468957/how-to-capture-http-response-with-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!