Another Fiddler Plugin Example

Here is another example of a fiddler plugin.  This plugin will loop through each request and mark a request to not be written to the web test if it ends in a particular extension.  This example shows you how to flag requests to not be written to the web test by setting the WriteToWebTest property on the Session object.  Please see my previous post for how to deploy the plugin: Writing Fiddler Web Test Plugins


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Fiddler;

using Fiddler.WebTesting;


namespace FiddlerPluginExample


    public class FilterExtensionExample : IFiddlerWebTestPlugin


        #region IFiddlerWebTestPlugin Members


        public void PreWebTestSave(object sender, PreWebTestSaveEventArgs e)


            //create a list of extensions to exclude

            List<string> extensionsToExclude = new List<string>();







            for (int i = 0; i < e.FiddlerWebTest.Sessions.Count; i++)


                //get the path part of the URL               

                string path = e.FiddlerWebTest.Sessions[i].FiddlerSession.PathAndQuery;


                //if there is a query string, strip it off

                int idxOfQueryString = path.IndexOf("?");

                if (idxOfQueryString > -1)


                    path = path.Substring(0, idxOfQueryString);



                //get the extension

                int idxOfExtension = path.LastIndexOf(".");

                if (idxOfExtension > -1)


                    string extension = path.Substring(idxOfExtension);

                    //if extension is in the exclude list then filter it

                    if (extensionsToExclude.Contains(extension))


                        //set the WriteToWebTest property to false

                        //to prevent the request from being written

//during save

                        e.FiddlerWebTest.Sessions[i].WriteToWebTest = false;











Comments (6)

  1. This is my last post for today, I promise. But Ed Glas (on the VSTS Test team) asked me to help publicize

  2. Buck Hodges says:

    Sean Lumley , a developer on the VSTS web test team, has written a series of posts on using a new version

  3. 沒聽過 fiddler ? 你也應該試試下載 Fiddler2 HTTP Debugger – Fiddler2 Sean Lumley’s Blog 整理了一份很詳細的文件, 你可以用 Fiddler

  4. shaheen says:

    Dear slumley,

    I am facing the following problem. can you guide me how to solve it.

    The type or namespace name 'IFiddlerWebTestPlugin' could not be found

    The type or namespace name 'PreWebTestSaveEventArgs' could not be found

    The type or namespace name 'WebTestSession' could not be found

    I am using latest version of fiddler and vs2008.



  5. Shaheen, read the following comments in the related post:…/writing-fiddler-web-test-plugins.aspx

    EricLaw [MSFT]

    12 Aug 2010 8:37 AM


    Due to Fiddler's new Import/Export Architecture, this code has changed in Fiddler 2.3.

    Fiddler (See…/fiddler2alphasetup.exe until released) re-introduces support for Webtest export plugins.

    You need to recompile your plugins referencing the new ImportExport

    VSWebTestExport.dll assembly (which has the WebTest plugin

    interface). By default, that assembly looks for your plugins in the

    DocumentsFiddler2ImportExportVSWebTestPlugins folder, unless you've

    overridden the path using the



Skip to main content