开发者

How can I create a working extension-dll for Fiddler with MS V C# 2008 EE?

this question reltates to TheChange's Question.

The requirements changed so I need to use an extension in Fiddler with the same task.

How can I create an extension with C# which will be excepted by Fiddler?

I can create an dll in C# - I also tried the old .net 2.0 compiler for it.. I first tried to use my extension in the Program-File folder and then in the MyDocuments folder (the two mentioned on the Fiddler-Website).

If I download an extension-dll from Fiddler-extensions it can be u开发者_JS百科sed after a restart of Fiddler.

If I try to replace my .dll file while Fiddler is running Windows tells me that the .dll is used by a program and cannot be changed now. The extension is not shown in the extensions-tab.

Right now Iam at dead-end, not knowing what I should search for now as noone else seems to have this problem.

maybe this is needed to answer my question:

using: MS Visual C# 2008 Express Edition My Project is in addition linked with Fiddler and System.Windows.Forms (didnt find System.Windows.WinForms which is mentioned on Fiddler).

used [assembly: Fiddler.RequiredVersion("2.2.7.0")] in my extension and my Fiddler is 2.2.8.x.

if this is of interest for the answers: I used IFiddlerExtension-Help description also to get the nessesary code.

My main problem is that Fiddler does not give me any notes or failures but seems to find the extension but cannot use it for some reason.

    using System;
using System.Windows.Forms;
using Fiddler;

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

namespace validate_js
{
    public interface IFiddlerExtension
    {
        // Called when Fiddler User Interface is fully available
        void OnLoad();

        // Called when Fiddler is shutting down
        void OnBeforeUnload();
    }
    public interface IAutoTamper : IFiddlerExtension
    {
        // Called before the user can edit a request using the Fiddler Inspectors
        void AutoTamperRequestBefore(Session oSession);

        // Called after the user has had the chance to edit the request using the Fiddler Inspectors, but before the request is sent
        void AutoTamperRequestAfter(Session oSession);

        // Called before the user can edit a response using the Fiddler Inspectors, unless streaming.
        void AutoTamperResponseBefore(Session oSession);

        // Called after the user edited a response using the Fiddler Inspectors.  Not called when streaming.
        void AutoTamperResponseAfter(Session oSession);

        // Called Fiddler returns a self-generated HTTP error (for instance DNS lookup failed, etc)
        void OnBeforeReturningError(Session oSession);
    }

    public class Violin : IAutoTamper
    {
        string sUserAgent = "";

        public Violin()
        {

            sUserAgent = "Violin";

        }
        public void OnLoad()
        {

            string strResponse;
            FiddlerApplication.Log.LogString("S&T-Script wird ausgeführt.");
            Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oS)
            {
                strResponse = oS.GetResponseBodyAsString(); // safe BodyContent in strResponse
                if (System.String.Compare(strResponse, "getElementbyID", true) == 0)
                {

                    FiddlerApplication.Log.LogString("getElementbyID found - could have a different attitude in IE 8. Please check");

                }

            };

        }
        public void OnBeforeUnload()
        {

        }

        public void AutoTamperRequestBefore(Session oSession)
        {
            oSession.oRequest["User-Agent"] = sUserAgent;
        }
        public void AutoTamperRequestAfter(Session oSession) { }
        public void AutoTamperResponseBefore(Session oSession) { }
        public void AutoTamperResponseAfter(Session oSession) { }
        public void OnBeforeReturningError(Session oSession) { }

    }


}

I would apreciate any help possible...


You're redeclaring the IAutoTamper and IFiddlerExtension interfaces within your namespace, which "hides" the real interfaces within the Fiddler namespace.

If you delete those interface redeclarations from your code (leaving just your Violin class), you will find that your DLL works just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜