views:

132

answers:

3

Hello everyone,

I am using ASP.Net + .Net 3.5 + VSTS 2008 + IIS 7.0 + C# to develop a web application. I want to use Fiddler to debug (i.e. monitor request and response Http traffic) local traffic -- i.e. when I test web application inside VSTS 2008's built-in test ASP.Net web server. Is that feasible? If yes, how to monitor such traffic? For example, in VSTS 2008's built-in ASP.Net test web application server, the Url I want to monitor request traffic sent to http://localhost:1870/Default.aspx and its response (i.e. when F5 is pressed in VSTS 2008).

BTW: I previously think Fiddler could only be used to monitor port 80 Http traffic, not sure whether port 1870 could be monitored?

thanks in advance, George

+2  A: 

Have you tried adding a dot after the localhost? Quick test on my machine seems to indicate this is needed in IE but might not be in Firefox actually.

Martin Smith
Hi Martin, I tried that dot works if I access a Url directly. But after accessing the page with dot url, if I click a link (for example, in code the url is written as "test.aspx"), there will be errors since ASP.Net test serve do not know how to access localhost.:1870/test.aspx (only knows how to access localhost:1870/test.aspx). Any ideas how to resolve page link issue in "dot" solution?
George2
In your "OnBeforeRequest" solution, for this statement -- "if(oSession.host == "<machinename>:<port>")", shall I change to "if(oSession.host == "localhost:1870")? The same question for statement "oSession.host=localhost:<port>", shall I change it to "oSession.host=localhost:1870"?
George2
@George - No I didn't need to do that. For me the development web server worked fine with the links. Are you using absolute URLs in your application?
Martin Smith
+1  A: 

Doesn't fiddler ignore 'Localhost' try changing the url's to your machines hostname.

Dog Ears
I think Cassini won't accept the connection if you try that (it only allows local connections and gets easily confused!).
Martin Smith
Hi Dog Ears, do you mean we can not use Fiddler to monitor Cassini traffic?
George2
"I think Cassini won't accept the connection if you try that" -- I think you mean Cassini does not allow using hostname, correct?
George2
@George2. Yes that is what I meant.
Martin Smith
Use ipv4.fiddler:1870 and fiddler will pick it up. See my answer below.
David Hoerster
+1  A: 

If you change your URL to 'http://ipv4.fiddler:1870/..' instead of 'http://localhost:1870/...' then fiddler will intercept your traffic and display the requests. Localhost doesn't go through wininet (I believe) which fiddler will then ignore. Fiddler registers ipv4.fiddler as localhost so you can monitor local traffic.

You can also add an entry to your hosts file and direct some URL (e.g. mysite.com 127.0.0.1) and use it as your URL (e.g. http://mysite.com:1870/...) and fiddler will pick that up, too.

David Hoerster