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”.

posted on Tuesday, June 29, 2004 12:05 AM by scott

Comments

Tuesday, June 29, 2004 12:58 AM by Eric Lawrence

# re: Debugging HTTP

Thanks for the mention, and the tip on the GlobalProxySelection class!
Wednesday, March 16, 2005 4:52 AM by Ben Empson

# re: Debugging HTTP

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?!

AHA, Ben
Friday, March 18, 2005 10:44 PM by Scott

# re: Debugging HTTP

I'm not sure, Ben. The GlobalProxySelection class has always worked for me....
Tuesday, May 02, 2006 8:43 PM by EricLaw [MSFT]

# re: Debugging HTTP

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.
Sunday, May 07, 2006 12:30 AM by Rick Strahl

# re: Debugging HTTP

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