Tuesday, July 29, 2014

FiddlerCore [Yes, that Fiddler]Core - A .Net Library that lets you add a little Fiddler to your apps

Rick Strahl's Web Log - Using FiddlerCore to capture HTTP Requests with .NET

Over the last few weeks I’ve been working on my Web load testing utility West Wind WebSurge. One of the key components of a load testing tool is the ability to capture URLs effectively so that you can play them back later under load. One of the options in WebSurge for capturing URLs is to use its built-in capture tool which acts as an HTTP proxy to capture any HTTP and HTTPS traffic from most Windows HTTP clients, including Web Browsers as well as standalone Windows applications and services.

To make this happen, I used Eric Lawrence’s awesome FiddlerCore library, which provides most of the functionality of his desktop Fiddler application, all rolled into an easy to use library that you can plug into your own applications. FiddlerCore makes it almost too easy to capture HTTP content!

For WebSurge I needed to capture all HTTP traffic in order to capture the full HTTP request – URL, headers and any content posted by the client. The result of what I ended up creating is this semi-generic capture form:

image

In this post I’m going to demonstrate how easy it is to use FiddlerCore to build this HTTP Capture Form. 

If you want to jump right in here are the links to get Telerik’s Fiddler Core and the code for the demo provided here.

Note that FiddlerCore is bound by a license for commercial usage – see license.txt in the FiddlerCore distribution for details.

...

[A whole bunch cut out]

Summary

FiddlerCore is a pretty sweet tool, and it’s absolutely awesome that we get to plug in most of the functionality of Fiddler right into our own applications. A few years back I tried to build this sort of functionality myself for an app and ended up giving up because it’s a big job to get HTTP right – especially if you need to support SSL. FiddlerCore now provides that functionality as a turnkey solution that can be plugged into your own apps easily.

The only downside is FiddlerCore’s documentation for more advanced features like certificate installation which is pretty sketchy. While for the most part FiddlerCore’s feature set is easy to work with without any documentation, advanced features are often not intuitive to gleam by just using Intellisense or the FiddlerCore help file reference (which is not terribly useful). While Eric Lawrence is very responsive on his forum and on Twitter, there simply isn’t much useful documentation on Fiddler/FiddlerCore available online. If you run into trouble the forum is probably the first place to look and then ask a question if you can’t find the answer.

The best documentation you can find is Eric’s Fiddler Book which covers a ton of functionality of Fiddler and FiddlerCore. The book is a great reference to Fiddler’s feature set as well as providing great insights into the HTTP protocol. The second half of the book that gets into the innards of HTTP is an excellent read for anybody who wants to know more about some of the more arcane aspects and special behaviors of HTTP – it’s well worth the read. While the book has tons of information in a very readable format, it’s unfortunately not a great reference as it’s hard to find things in the book and because it’s not available online you can’t electronically search for the great content in it.

But it’s hard to complain about any of this given the obvious effort and love that’s gone into this awesome product for all of these years. A mighty big thanks to Eric Lawrence  for having created this useful tool that so many of us use all the time, and also to Telerik for picking up Fiddler/FiddlerCore and providing Eric the resources to support and improve this wonderful tool full time and keeping it free for all. Kudos!

Resources

...

" [Click through for the rest... yes, you'll want too... oh just click already... ;]

I was first going to ask "When did Telerik buy Fiddler?" but then saw I already blogged about that almost two years ago. sigh... darn old brain.

Anyway, this is the first I'd heard of FiddlerCore (I think, lol) and Rick does a great job of introducing it and running it through its paces. If you need to packet/network sniff in your apps (i.e. you've said to your self, "Self, I wish I could build something like Fiddler into my app," well you can! (and stop talking to yourself, it's a little creepy ;)

 

Related Past Post XRef:
Fiddler (yes, that Fiddler) has been acquired by Telerik... [Updated with snips from Chris and Eric, Fiddler = Free++]

What do Fiddler, LinqPad, Excel and SharePoint have in common? Testing and consuming OData of course!
Fiddling as the web burns (or how to find out why it's burning) - “Debugging with Fiddler" book now available
eXpert Web Performance Analysis via Fiddler - Microsoft neXpert Performance Analysis Plugin [For Fiddler]
15 Second Introduction to Fiddler
Fiddler 2.1 Released...
Fiddler2 (Fiddler + HTTPS) Alpha Released
Microsoft Fiddler 1.2 Released and now Officially Out of Beta
Fiddler PowerToy - Part 1: HTTP Debugging
Fiddler HTTP Debugger - Fiddler

No comments: