Create Fiddler Classic Extension Project
Follow these steps to create a sample Fiddler Classic Extension that modifies the User-Agent string of all outbound requests:
Add Reference to Fiddler
Start Visual Studio 2005 or later.
Create a new Project of type Visual C# Class Library.
Right-click the project's References folder in the Solution Explorer.
Click the Browse tab and select Fiddler.exe in the %localappdata%\Programs\Fiddler folder.
Click Ok to add the reference.
Add Reference to System.Windows.Forms
If your extension modifies Fiddler's UI:
Right-click the project's References folder in the Solution Explorer again.
On the .NET tab, choose System.Windows.Forms.
Click Ok to add the reference.
Add Build Event
In the Solution Explorer, right click the project.
Click Properties.
Click the Build Events tab.
-
Add the following to the Post-build event command line:
copy "$(TargetPath)" "%userprofile%\Documents\Fiddler2\Scripts\$(TargetFilename)"
Implement a Fiddler Classic Interface
Modify the default class1.cs (or create a new class) in your project as follows:
using System;
using System.Windows.Forms;
using Fiddler;
[assembly: Fiddler.RequiredVersion("2.3.5.0")]
public class Violin : IAutoTamper // Ensure class is public, or Fiddler Classic won't see it!
{
string sUserAgent = "";
public Violin(){
/* NOTE: It's possible that Fiddler Classic UI isn't fully loaded yet, so don't add any UI in the constructor.
But it's also possible that AutoTamper* methods are called before OnLoad (below), so be
sure any needed data structures are initialized to safe values here in this constructor */
sUserAgent = "Violin";
}
public void OnLoad(){ /* Load your UI here */ }
public void OnBeforeUnload() { }
public void AutoTamperRequestBefore(Session oSession){
oSession.oRequest["User-Agent"] = sUserAgent;
}
public void AutoTamperRequestAfter(Session oSession){}
public void AutoTamperResponseBefore(Session oSession){}
public void AutoTamperResponseAfter(Session oSession){}
public void OnBeforeReturningError(Session oSession){}
}
See Fiddler Classic Interfaces.