如何在C#中打印出HttpWebRequest?
我在使用 C# 中的 HttpWebRequest 对象执行 POST 时遇到问题。 为了分析问题,我想确切地知道通过网络发送的内容。 问题是我也使用 HTTPS,所以我无法嗅探线路。 我需要某种方法将 HttpWebRequest 对象的所有相关信息或类似信息打印到控制台。 感谢您的帮助。
I'm having a problem with a POST I'm doing using the HttpWebRequest object from C#. In order to analyze the problem I would like to know exactly what is being sent over the wire. The problem is that I'm also using HTTPS so I can't sniff the wire. I need some way of printing out to the Console all the relevant information of the HttpWebRequest object or something like that. Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Fiddler 调试 HTTPS 流量。
You can use Fiddler to debug HTTPS traffic.
您能否在代码中设置一个断点,然后在调试器中查看 Request 对象,并查看 ServerVariables 集合以查看它有什么内容? 或者,您可以对 Request.ServerVariables 中的每个元素执行 Response.Write 循环,并查看存储在网页中的名称/值对(如果需要)。
Could you set a breakpoint in the code and look at the Request object in the debugger and look through the ServerVariables collections to see what it has? Alternatively, you could do a Response.Write looping over each element in the Request.ServerVariables and see the name/value pairs that are stored in a web page if you want that.