Thursday, December 15, 2016

How to catch HTTP requests from any .NET application in Fiddler

Fiddler is a great tool to intercept and analyse HTTP traffic. By default Fiddler only captures HTTP requests from applications started by you. But there are also applications started by other accounts. For example you may want to anaylze HTTP traffic from Windows Service started by LocalSystem account. Here I'll explain how to capture HTTP requests from any .NET application.

First of all you need to start Fiddler. It will set proxy in your system. We need URL of this proxy. To get it open Control Panel and open Internet Options. Go to Connections tab and click on "LAN settings" button. In the modal dialog click on "Advanced" button. You'll see address of Fiddler proxy:

Now we are ready to edit .config file of our .NET application. You should set default proxy there:

<configuration>
  <system.net>
    <defaultProxy>
      <proxy autoDetect="false" bypassonlocal="false"
             proxyaddress="http://127.0.0.1:8888"
             usesystemdefault="false" />
    </defaultProxy>
  </system.net>
</configuration>

As you can see we use the same URL here. Now just restart the .NET application and it will send all its HTTP traffic through Fiddler. Don't forget to remove the changes from .config when you finished your work.

No comments:

Post a Comment