Roman Starkov
Roman Starkov

Reputation: 61512

Dump WebRequest transmissions for debugging purposes?

My application is performing numerous HttpWebRequests, and some of them fail occasionally. I would like to dump the bytes leaving my PC whenever I perform a request as well as the bytes arriving as a response.

Is it possible to do this from within my code easily?

I'd only like to use something like Wireshark as a last resort if no other method is available, as I'd like such dumping to be available on the clients' machines without having to install WinPcap and stuff.

Upvotes: 0

Views: 551

Answers (3)

Roman Starkov
Roman Starkov

Reputation: 61512

What I'm doing now is wrapping HttpWebRequest into a class which just dumps all the response headers and body into a specified file. Same for the request, though it's a bit clumsy with POST requests.

The worst thing about this is that I have to change all code that uses HttpWebRequest to use this new wrapper class, but it's not too bad.

Upvotes: 0

Shane Powell
Shane Powell

Reputation: 14158

There is Microsoft's NetMon or as you said a WinPCap based product like Wireshark. Just like Wireshark, it can be overkill for just HTTP.

As the other post said, there is Fiddler2 is a lot easy to use for debugging HTTP. Also it is useful in debugging HTTPS where NetMon/Wireshark is of no use...

Upvotes: 0

Wyatt Barnett
Wyatt Barnett

Reputation: 15663

Check out Fidller2 -- yeah it is installing something, but it's not anywhere near as involved as wireshark and it will give you much more useful information. Including being able to dump the streams into re-playable series.

Upvotes: 1

Related Questions