Video icon
Video Tutorials
Search this site
Get Fiddler! Addons Help & Documentation Developer Info Discuss Contact

Please note: The FiddlerAPI is still under construction, and future releases may require changes to your Inspector plugins.  Thanks for your patience.

Building Fiddler Inspectors

Building custom Inspector objects for Fiddler is easy!  You can use any .NET language, although I'll present my examples in C#.

Note: Fiddler v2.x requires .NET Framework v2.0 assemblies (compile with VS2005).

Working with the new Inspector2 interfaces

If you have inspectors written for older versions of Fiddler, please see Porting Extensions to Fiddler v2.1

Step-by-Step

  1. File | New Project

  2. Pick VC# Projects | Class Library

  3. Type a name, e.g. WebBrowser

  4. Hit OK.

  5. In Solution Explorer, right-click References and choose Add Reference

  6. Hit Browse and find Fiddler.exe

  7. On the .NET tab, you probably want to add a reference to System.Windows.Winforms as well.

  8. Ensure both libraries are in the Selected Components List and hit OK.

In Solution Explorer, rename Class1.cs to whatever, e.g. WebViewer.cs

Change the code to derive from the Inspector2 class.  Also, implement either IResponseInspector2 or IRequestInspector2.

using Fiddler;

[assembly: Fiddler.RequiredVersion("2.1.1.0")]

public class WebViewer: Inspector2, IResponseInspector2
{
   public Viewers()
   {
   //
   // TODO: Add constructor logic here
  //
   }
}

Inside the class, create a new method. By typing public override, you'll get an autocomplete list of the methods you need to write.

In Solution Explorer, right-click on the project and choose Add | User Control

Use the Toolbox to add controls to your user control-- these will show the data about the HTTP message under Inspection.

In the body{ set } and headers{ set } properties, you should update your control's visual representation of the request or response. 


Almost done...

  • Compile your project.

  • Drop your assembly .DLL in the \Fiddler2\Inspectors folder

  • Restart Fiddler2

If you need help or have questions, please email me using the Contact link above.


TextViewer.cs

using System;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
using Fiddler;

[assembly: Fiddler.RequiredVersion("2.1.1.0")]

namespace Standard
{
 public class RequestTextViewer: Inspector2, IRequestInspector2
 {
 TextView myControl;
 private byte[] m_entityBody;
 private bool m_bDirty;

 private bool m_bReadOnly;

 public bool bReadOnly{
 get {
   return m_bReadOnly;
 }
 set{
   m_bReadOnly = value;   // TODO: You probably also want to turn your visible control GRAY (false) or WHITE (true) here depending on the value being passed in.  
  }
 }

public void Clear(){
  m_entityBody = null;
  myControl.txtBody.Clear();
}

public RequestTextViewer()
{
  // TODO: Add constructor logic here
}

public HTTPRequestHeaders headers{
 get {
  return null;    // Return null if your control doesn't allow header editing.
  }
 set{
  }
}

public byte[] body
{
 get
 {
   return m_entityBody;
 }
 set
 {    // Here's where the action is.  It's time to update the visible display of the text
  m_entityBody = value;
 
  if (null!=m_entityBody){
   myControl.txtBody.Text = System.Text.Encoding.UTF8.GetString(m_entityBody); // TODO: Use correct encoding based on content header?
  }
  else {
   myControl.txtBody.Text = "";
  }
  m_bDirty = false;   // Note: Be sure to have an OnTextChanged handler for the textbox which sets m_bDirty to true!
}

public bool bDirty
{
 get
  {
    return m_bDirty;
  }
}

public override int GetOrder()
{
 return 0;
}

public override void AddToTab(System.Windows.Forms.TabPage o)
{
  myControl = new TextView(this);   // Essentially the TextView class is simply a usercontrol containing a textbox.
  o.Text = "TextView";
  o.Controls.Add(myControl);
  o.Controls[0].Dock= DockStyle.Fill;
}

}
}
 



©2008 Microsoft Corporation