This is a migrated thread and some comments may be shown as answers.

Adding a custom button to clear sessions stops Fiddler from Capturing

3 Answers 232 Views
Windows
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 26 Nov 2019, 09:59 PM
I got a new machine and I added the code below according to this post. https://www.telerik.com/forums/remove-all-as-a-single-click-button-on-the-toolbar
Now after clicking on the BYE button, it clears the entries but Fiddler stops capturing anything from any site anymore. It only work once once I restart Fiddler.
It used to work on my old machine. I can't figure out what is different here.



 static function RemoveAll(s: Object, e: EventArgs)
    {
        FiddlerApplication.UI.lvSessions.Clear();                   
    }
    
    static function OnBoot() {
        
        try {
            for (var c in FiddlerApplication.UI.Controls)
            {
                if (c.GetType().Name == "ToolStrip")
                {
                    var ts: ToolStrip = c;
                    var tsi: ToolStripButton = new ToolStripButton("BYE!");
                    tsi.add_Click(RemoveAll)
                    ts.Items.Insert(0, tsi);
                }
            }
        } catch(e) { FiddlerApplication.Log.LogString(e); } 
        
    }

3 Answers, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 29 Nov 2019, 09:46 AM

Hello Tony,

It seems that the view update is messed up after the call, as the session update counter at the toolbar is still updated property. 

You could try:

FiddlerApplication.UI.actRemoveAllSessions();

in the script to clear the sessions instead (this is the code used by the original Remove All button).

Regards,
Boby
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tony
Top achievements
Rank 1
answered on 04 Dec 2019, 02:12 AM
That works. Thanks. Another issue is I have to click the button twice. Can it work from the first click?
0
Boby
Telerik team
answered on 05 Dec 2019, 07:41 AM

Hi Tony,

This is strange, for me it's working from the first time. My full script is as follows:

class Handlers
{
            
    static function RemoveAll(s: Object, e: EventArgs)
    {
        FiddlerApplication.UI.actRemoveAllSessions();
        
    }
    
    static function OnBoot() {
        
        try {
            for (var c in FiddlerApplication.UI.Controls)
            {
                if (c.GetType().Name == "ToolStrip")
                {
                    var ts: ToolStrip = c;
                    var tsi: ToolStripButton = new ToolStripButton("Remove all");
                    tsi.add_Click(RemoveAll)
                    ts.Items.Insert(0, tsi);
                }
            }
        } catch(e) { FiddlerApplication.Log.LogString(e); } 
        
    }
}

Maybe something else in your script is interfering? 

Regards,
Boby
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Windows
Asked by
Tony
Top achievements
Rank 1
Answers by
Boby
Telerik team
Tony
Top achievements
Rank 1
Share this question
or