Using fiddler to locate redirect loop

Sometimes you may experience problems when debugging your website where your browser simply returns what seems to be a 404-error.


Usually it is right, but you may experience sometimes that it is not a real 404-error.

I have created a very simple website using Visual Studio with 2 pages. Each page simply redirects to the other page, so the browser will continually be redirected between the two pages. This logic forces the browser to display a 404-like page after a couple of redirects when it decides that it will never arrive at a correct page. The number of redirects taken by the browser varies by browser, in my simple test IE performs approximately 120 redirects before giving up.


So the question is how to figure out what is happening. In comes Fiddler. This is a tool that you can use to monitor all the requests from your browser to a given server, so it can be used to monitor the raw data of the communication between the browser and the server.

The tool does this by acting as a proxy server once it is started, so all browser requests are proxied through the application and can therefore be monitored, and this is done automatically, so all you have to do is to start fiddler and then it sets everything up (for most basic pc setups)


When the application is started we can begin the test by making a request to a non-existent page just to see what is displayed in Fiddler.image

From this it is fairly simple to see that you reached a non-existent page. This can be seen in the result column, that displays 404, which is the http code for a non existent page.

If I instead try to visit one of my redirecting pages, then it looks like this


If I look closely at this list I can see that I request page1 –> page2 –> page1 and so forth, and this continues until the browser displays an error page.

I can see in the result column that the http code returned is 302, which is redirect.


So that is a simple use of fiddler to figure out why a page is not displayed. Of course there may be many other reasons which I will try to explore in another blog post.

Comments are closed