Is there any good way (short of installing WireShark) to get the raw http request data sent to a webserver? I suspect the request I'm sending is incorrect or malformed but I don't know how to get at the raw request string that its sending to the webserver with a call to WebClient.UploadValues.
1 Answer
Fiddler it's among us, Windows Developers, for quite some time, and even though it was bought by Telerik it's still one of the best tools to debug everything that goes on the wire.
By the way, Fiddler is not only meant for ".NET WebClient", it's for everything that is happening in your computer throughout your network, and extremely helpful when debug ajax
requests in javascript!
- On the left side, you will have all objects going through the "wire" with nice color coding
- On the Right side, everything that you can know about a selected request/response
- The Right side is divided in 2 parts vertically, top area means request, bottom area means response
Just select the request you sent on the left side, and on the right side choose Inspector and on top, select either Header (to see the full headers) or Raw to see the full text that was sent, and on the bottom do the same.
If you're not getting any information on the response, set the Transformer to No Compression so you can see the entire response, even if it was compressed.
For more, see the tutorials on their page
Also, install the Syntax Highlighting Addon... it's very useful
For your particular issue:
- open Fiddler
- on your webpage, do everything until the moment you click in an action to perform what you need
- Go back to Fiddler and clear all requests Edit > Remove > All Sessions or Ctrl + X
- click your link or button that would make that request you need to debug
- see what's going on on the list
- click on the request (on the left side)
- choose Raw in the Inspector
- see the response as well by clicking Raw on the bottom part of the request details
- see all other views and find the problem