Does System.Windows.Forms.Form work in Fiddler script?

1 posts, 0 answers
  1. Ed
    Ed avatar
    4 posts
    Member since:
    May 2017

    Posted 27 Jun 2017 Link to this post

    I know it uses Jscript.NET but is there some special context it runs within (and is documented somewhere) that would prevent me from instantiating a Form to input a string, select from a radio button group, etc? Or is a different file supposed to be edited?

    When I try to add the following to CustomRules.js in the ScriptEditor, it says "ERROR LINE --> MyForm myform = new MyForm() - The list of attributes does not apply to the current context" when I save the script.


    Here is the Form class I am trying to use to make a dialog:

    import System.Windows.Forms;
    import System.ComponentModel;
    import System.Drawing;
    class MyForm extends System.Windows.Forms.Form {  
        // declare variables
        private var label1: Label;
        private var textBox1: TextBox;
        private var button1: Button;
        private var panel1: Panel;
        // constructor
        function MyForm() {                        
            //SuspendLayout(); // suspend layout events
            // label, size, and center form
            Text= "Resize Me!";
            ClientSize= new System.Drawing.Size(300,300);
            StartPosition= System.Windows.Forms.FormStartPosition.CenterScreen;
            // create a label
            label1= new Label;      
            label1.Location= new Point(10,10);
            label1.Size= new System.Drawing.Size(80,20);
            label1.Name= "label1";
            label1.Text= "Label";
            label1.Anchor= AnchorStyles.Left;
            // create a TextBox
            textBox1 = new TextBox;
            textBox1.Location= new Point(10,30);
            textBox1.Size = new System.Drawing.Size(80,20);
            textBox1.Name= "textBox1";
            textBox1.Text = "Hello World";
            textBox1.Anchor= AnchorStyles.Left;                           
            // create a Button
            button1= new Button;
            button1.Location= new Point(200,240);
            button1.Size= new System.Drawing.Size(80,20);
            button1.Name= "button1";
            button1.Text= "Button";
            button1.Anchor= AnchorStyles.Right | AnchorStyles.Bottom;
            // create a Panel
            panel1= new Panel;
            panel1.Location= new Point(0,0);
            panel1.Size= new System.Drawing.Size(300,300);
            panel1.Name= "panel1";
            // resize panel on resize form
            panel1.Anchor= AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            // add controls to the panel
            // add panel to form
            //ResumeLayout(); // resume layout events
        } // end_constructor
    } // end_class
    class Handlers {
        static function BeforeTestList(arrSess: Session[]): boolean
            MyForm myform = new MyForm();
            return true; // Test should proceed; return false to cancel
Back to Top