Den Delimarsky

I am an engineer working on API documentation, security and machine learning.

github twitter linkedin rss

Windows Phone emulator: capturing traffic with Fiddler or WireShark

Sep 19, 2010
4 minutes read

While working on a Windows Phone 7 application today I noticed that some web requests are skipped by the application. In fact, the callback for the receiving method was never called, so I decided to track the outbound traffic via a local proxy tool. I actually tried two of them, and here is what I got.

Fiddler

Fiddler was the first choice when I decided that I need to keep track of what’s being requested by the application. I launched it, launched the emulator through Visual Studio (I simply built a WP7 solution) and… nothing happened. Well, in fact something happened – my application crashed with a WebException – NotFound:

Image no longer available

On the Fiddler webpage it is stated that Fiddler should pick up system proxy settings automatically and then use those for outbound transactions, but this isn’t happening. I am not sure whether this is an issue with the current emulator build, but it is not able to pick up the system proxy to redirect addresses. Although the proxy settings are correctly set, Fiddler wasn’t able to track any requests and my application still crashed.

For now, there are no settings in the emulator software that would let you set the proxy policies, so what I had to do is dig deeper in Fiddler. One of the solutions (or shall I say, workarounds) is to set Fiddler as a reverse proxy by creating a redirect rule.

The emulator is still able to pick up the proxy address (set to 127.0.0.1:8888 on my machine), so I simply followed the instructions here. First of all, I created a rule that would redirect to the needed host when the proxy address is accessed.

Image no longer available

Right inside the OnBeforeRequest function, I simply inserted a line that would check whether the requested address is the one assigned to the proxy and redirect to another host if that’s the case.

Image no longer available

Now, I simply create a web request to 127.0.0.1:8888 in my Windows Phone 7 application and it redirects me to the host I wrote in the rule. Every request for that host is now indexed in Fiddler.

Image no longer available

WireShark

What I like about WireShark is that it works without additional proxy configurations, although on the packet level. I managed to track my requests from the Windows Phone 7 emulator just fine and see if those go through or are lost.

Image no longer available

It can be easily customized to work on different network interfaces (if available) and it allows to set specific filters when it comes to incoming results.

One less attractive aspect (for me, at least) compared to Fiddler is the fact that HTTP requests are basically hidden. You should keep an eye on the Info column and once you see POST or GET, that’s where you should look.

Image no longer available

Once you expand Hypertext Transfer Protocol, you will be able to see detailed information about the request itself rather than the work packets.

Although I understand that WireShark has a different purpose – basically it grabs packets instead of simply keeping track of HTTP request – it is a protocol analyzer, after all – so I am not saying that what I’ve described above is a bad thing. It’s simply too much information displayed for what I need (although you can set specific filters).

Conclusion

It’s always good when you have a choice. The Fiddler configuration I’ve outlined above has one limitation – it won’t show the detailed set of web requests coming/going from/to a specific host – only the initial “welcome” request. While WireShark will pretty much show the entire content set since the request initialization till it’s completion. I’d use both tools for testing purposes, but I hope that I will soon enough find a way to configure Fiddler (or Windows Phone 7 emulator for that matter) to correctly work with WP7 development tools.


Back to posts