简体   繁体   中英

Debugging .net's WebClient

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.

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!

Install and fire it up

  • 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:

  1. open Fiddler
  2. on your webpage, do everything until the moment you click in an action to perform what you need
  3. Go back to Fiddler and clear all requests Edit > Remove > All Sessions or Ctrl + X
  4. click your link or button that would make that request you need to debug
  5. see what's going on on the list
  6. click on the request (on the left side)
  7. choose Raw in the Inspector
  8. see the response as well by clicking Raw on the bottom part of the request details
  9. see all other views and find the problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM