官方版
Create Fiddler Extension Project
Follow these steps to create a sample Fiddler 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 C:\Program Files\Fiddler2 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%\My Documents\Fiddler2\Scripts\$(TargetFilename)"
Implement a Fiddler 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 won't see it!{string sUserAgent = "";public Violin(){/* NOTE: It's possible that Fiddler 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 besure 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 Interfaces.
Compile and Load Extension
谷歌翻译版
创建Fiddler扩展项目
请按照以下步骤创建一个示例Fiddler Extension,以修改所有出站请求的User-Agent字符串:
添加对Fiddler的引用
- 启动Visual Studio 2005或更高版本。
 - 创建一个Visual c#类库类型的新项目。
 - 在解决方案资源管理器中右键单击项目的References文件夹。
 - 单击Browse选项卡并选择Fiddler.exe C:\Program Files\Fiddler2文件夹。
 - 
添加对System.Windows.Forms的引用
如果你的扩展修改了Fiddler的UI:
 再次在解决方案资源管理器中右键单击项目的References文件夹
- 在.NET选项卡上,选择“ System.Windows.Forms”。
 - 
添加构建事件
 在“解决方案资源管理器”中,右击项目。
- 单击属性
 - 单击Build Events选项卡。
 将以下内容添加到生成后事件命令行
copy "$(TargetPath)" "%userprofile%\My Documents\Fiddler2\Scripts\$(TargetFilename)"
实现一个Fiddler接口
在项目中修改默认的class1.cs(或创建一个新类),如下所示
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 won't see it!{string sUserAgent = "";public Violin(){/* NOTE: It's possible that Fiddler 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 besure 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){}}
编译并且加载扩展
