Extending ExecAction with .NET

The following example demonstrates how to add a custom ExecAction handler with .NET.

This example adds a new ExecAction command "clearcache" which will use Fiddler's built in cache clearing function when executed.

C#

using Fiddler;
 
[assembly: Fiddler.RequiredVersion("2.2.2.0")]  //Necessary for Fiddler to load the assembly
 
namespace ExecActionExample
{
    public class ClearCacheDemo: IFiddlerExtension, IHandleExecAction
    {
        //Required Function
        public void OnLoad()
        {
        }
 
        //Required Function
        public void OnBeforeUnload()
        {
        }
 
        //Required Function - Used to handle an ExecAction command
        public bool OnExecAction(string action)
        {
            if (action.equals("clearcache"))
            {
                //Here is where your code will execute.  For example, you could dump all the current requests/responses captured to a text file
 
                FiddlerApplication.UI.actClearWinINETCache();
 
                return true;  //The command was handled successfully
            }
 
            return false;  //The command was not handled and allows other ExecAction handlers to process
        }
    }
}

VB

TODO
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License