« Airports make me sick… | Main | Fiddler and .Net Authentication »

Fiddler HTTP Debugger

A few months ago, one of my co-workers told me about Fiddler.  It’s an HTTP Debugging tool that allows you to “fiddle” with HTTP traffic.  At the time I was busy with other issues and features and didn’t have much use for it.  I got it installed but never used it.

Yesterday I came across an issue where I needed to fake a NewsGator API call into returning a 503.  In the past, I’ve used one of our staging servers and simply messed around with the IIS configurations so that all calls returned 503 errors.  It worked for what I needed to get done, but since we all share these machines I had to set aside time later in the evening when others weren’t using it.  Not a very flexible option. 

So first I tried a free firewall app that I thought might do the trick.  Instead it tricked my dev box into rebooting in a continuous loop.  An hour later, after regaining control on my machine, I decided to walk around the office and see if anyone had any better ideas.

Brian Reischl – another developer who is quickly becoming my goto for about any problem – came up with a great idea… write a custom rule with Fiddler.

It turns out that Fiddler has this great javascript file that allows you to modify HTTP requests or responses and be able to turn that functionality on or off on the fly.  Exactly what I needed! 

After adding this to the Handlers class:

public static RulesOption("503 NewsGator Production Services Requests")
var m_503NGPS: boolean = false;

and this to the OnBeforeResponse function:

if(m_503NGPS && oSession.url.indexOf("services.newsgator.com")>-1)
{
  oSession.responseCode = 503;
}

I was on my way.  Very cool!

With this type of flexibility I can only imagine all the types of situations I’ll be able to reproduce, which will lead to much better handling of these situations in my applications.

Posted by Nick Harris on August 31, 2006 at 09:51 PM | Permalink

Comments

Did you know that Newsgator Inbox has problems with Fiddler?, it cannot receive anything while fiddler is running...

Posted by: AsbjornM | Sep 1, 2006 4:09:25 AM

Hmmm, you're right. It looks like a problem with how the framework handles authentication. I'll play around with it and see if I can get it working.

Posted by: Nick Harris | Sep 1, 2006 9:22:09 AM

Stop it, you're making me blush :)

Posted by: Brian Reischl | Sep 1, 2006 12:37:17 PM

Thanks for the mention! Can you send me repro steps for the problem you encountered with Newsgator?

Posted by: EricLaw | Sep 23, 2006 4:29:42 AM

Ah, I see now that your next post covers this. :-)

Posted by: EricLaw | Sep 23, 2006 4:32:15 AM

The comments to this entry are closed.