Fiddler Tool

The Fiddler HTTP debugging tool helps solve caching errors. For example, we enable private caching for performance benefits. We use the Fiddler tool for debugging. We see some examples of its output on a website.

Fiddler and HTTP headers

HTTP and Fiddler

For the example, I will examine private caching in ASP.NET. I required a private cache in ASP.NET, meaning one that only the browser would keep. Then I use Fiddler to see what happens. You don't need to change any code to use Fiddler, but here I show the ASP.NET code so we can see what it does. We enable ASP.NET caching and use Fiddler to make sure it works right.

Client-side caching

Here we note that client-side caching is a suggestion. You can use HttpCachePolicy in ASP.NET to indicate to the browsers that they don't need to re-download pages every time. Here we tell browsers to cache pages in their memory. This saves network accesses, and makes everything faster. Use HttpCachePolicy in ASP.NET.

Fragment that uses SetCacheability [C#]

//
// Suggest browsers cache the page.
//
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.Cache.SetExpires(DateTime.Now.AddMinutes(5));

How can I use Fiddler?

Question and answer

Open it alongside Internet Explorer, Google Chrome, or Safari. Fiddler is a HTTP debugging proxy, and we use it to see HTTP connections. It is not only for ASP.NET or IIS. Similar tools are available in Firefox and Safari.

The left side shows connections. These connections are made. The first column shows the Result, which is 200 for HTTP success. Other codes are the famous 404, and 302. It uses special icons. In the left side, blue indicates requests and green indicates downloads. You see when a page wasn't in the client-side cache.

Server-side caching

Servers can also cache HTML on their end, but Fiddler can't distinguish these loads. Server-cached pages will still be sent even if they haven't changed. You should make it so when the user clicks back, your page loads from the browser cache. Visitors click the site icon multiple times. You can test this with Fiddler.

GZIP compression

GZIP compression

You can use Fiddler to see how much GZIP compression would help your website. Click the radio button on the Transformer tab to count bytes. Additionally, you can read the raw binary in GZIP files using HexView. I used this to see the original file names in my GZIP files. This is useful for low-level server bugs.

View images

Here we mention that you can view images directly in the Fiddler debugging tool, and this can make some debugging responses easier. On the ImageView tab, you can see the images that are sent through HTTP. This is useful for dynamic images, such as those in ASHX handlers.

ASHX Handler Tutorial

Examine headers

You can examine the HTTP headers sent from the web server or to the web server by the browser. On the right side of Fiddler, which you can open by double clicking on an item in the left pane, click on Inspectors and then on Headers. These are the raw HTTP headers.

Statistics

Here we note the statistics pane in the Fiddler debugging tool. On the statistics pane, Fiddler offers some estimates about transfer times. I have not found these to be useful. Use web benchmarks instead.

HTTP Compression Overview

Support

Programming tip

Fiddler is a free tool maintained by a single author. Because it is expensive to maintain, it is worthwhile to donate money to the author if the program has proven useful to you.

Summary

We looked at the Fiddler HTTP debugging proxy tool for the Windows operating system. Caching is complex, but tools like Fiddler or Firebug make it much easier to debug. Using private caching on dynamic pages is important. I explored cache expiration and show code to allow output caching elsewhere on this site.

Fiddler site Cache Examples ASP.NET Tutorials
.NET