Debugging HTTP

In debugging some web service wierdness I downloaded Fiddler. Fiddler is an excellent tool for viewing and experimenting with the HTTP headers and payload exchanged between client and server. I've never used a debugging proxy that is so easy and informative.

Any software using the WinINET API (like IE) will automatically send traffic through fiddler when the “Act as System Proxy” check box is checked.

For the .NET classes like HttpWebRequest and WebClient, I found the GlobalProxySelection class is pretty useful for setting the proxy programatically:

GlobalProxySelection.Select = new WebProxy("127.0.0.1", 8888);

Before yesterday I didn't know this class existed. It's amazing what I can find when I venture outside of my “framework comfort zone”.

Print | posted @ Tuesday, June 29, 2004 7:05 AM

Comments on this entry:

Gravatar # re: Debugging HTTP
by Eric Lawrence at 6/29/2004 7:58 AM

Thanks for the mention, and the tip on the GlobalProxySelection class!
<br>
  
Gravatar # re: Debugging HTTP
by Ben Empson at 3/16/2005 11:52 AM

Hi there, I'm trying to use fiddler for local debugging of a webservice too. Difference is my soap server is written in PHP5 running on Apache on port 81. I simply cannot get my .Net application to run through fiddler for this setup?! I don't get it, as if I access the webservice through IE, fiddler picks up on everything quite happily, so it can't be the port. Don't suppose you have any ideas do you?!
<br>
<br>AHA, Ben
  
Gravatar # re: Debugging HTTP
by Scott at 3/19/2005 5:44 AM

I'm not sure, Ben. The GlobalProxySelection class has always worked for me....
  
Gravatar # re: Debugging HTTP
by EricLaw [MSFT] at 5/3/2006 3:43 AM

The .NET Framework automatically bypasses http://127.0.0.1; you need to use IE to hit http://machinename for the framework to use the proxy.
  
Gravatar # re: Debugging HTTP
by Rick Strahl at 5/7/2006 7:30 AM

Scott, depending on your proxy settings in your .config file, .NET will automatically pick up any proxy changes made in IE including Fiddler. The default in .NET 2.0 is to use the System Proxy settings and so you should automatically see Web Service or WebRequest requests show up in fiddler even against localhost (since Fiddler clears the bypass list).

To be sure though use the machine name as Eric recommends - the NetBios name should always work.

Note this can be turned off in Web.Config and in fact in Web applications, especially local ones you probably want to turn the auto-proxy off.

http://west-wind.com/weblog/posts/3871.aspx
  
Comments have been closed on this topic.