Tip on using Fiddler with cassini and localhost

Published Wednesday, August 13, 2008 11:03 AM

A lot of us use Fiddler to debug traffic from our applications. Fiddler doesn't work with requests to localhost. When debugging an ASP.NET website, we can always use the machine name instead of localhost. However, when using the ASP.NET development server (aka Cassini), we cannot use the machine name (since Cassini blocks requests other than localhost). We can hence do either of the following:

1. Append a "." to localhost.

So, if your url looks like: http://localhost:12825/, try using http://localhost.:12825/ instead. Or, if your url looks like "http://localhost/TestApp/Test/Default.aspx", try using
http://localhost./TestApp/Test/Default.aspx" instead. It works with fiddler    


2. Within Fiddler, on the menu, click Rules->Customize Rules. Within the function OnBeforeRequest(oSession:Fiddler.Session), add the following:

if(oSession.host == "<machinename>:<port>")
{
 oSession.host="localhost:<port>";
}

 If this doesn't work, just change the line to be oSession.host="127.0.0.1:<port>";.

and now make a request to http://machinename:<port>. This way fiddler gets the request and cassini gets it too.

Have fun using fiddler. Here it is (http://www.fiddlertool.com/fiddler/).

Comments

# jstengel said on Wednesday, August 13, 2008 2:21 PM

Nice tip! Thanks.

# funny wallpaper » Tip on using Fiddler with cassini and localhost said on Wednesday, August 13, 2008 2:35 PM

Pingback from  funny wallpaper &raquo; Tip on using Fiddler with cassini and localhost

# carnewsservice.info » Tip on using Fiddler with cassini and localhost said on Wednesday, August 13, 2008 3:09 PM

Pingback from  carnewsservice.info &raquo; Tip on using Fiddler with cassini and localhost

# preishuber said on Thursday, August 14, 2008 1:43 AM

reeinventing the wheel

weblogs.asp.net/.../use-httpfiddler-with-asp-net-development-server-and-ie7.aspx

# Must have tools for .NET developers | Veggerby : IBlog said on Friday, September 12, 2008 11:26 AM

Pingback from  Must have tools for .NET developers | Veggerby : IBlog

# freddy said on Friday, January 16, 2009 2:43 AM

or just use ipv4.fiddler which calls localhost

# pthalacker said on Monday, March 02, 2009 1:37 PM

When I use this trick it prevents me from establishing the trust relationaship with the web service I am trying to debug.

# Leonid said on Wednesday, May 13, 2009 9:32 PM

Dude!  I've been having this problem for forever and I finally found this. You rock :)  

I had to use Fiddler rules - the "." trick didn't work for me.

Leave a Comment

(required) 
(required) 
(optional)
(required)