2

この質問はTheChange's Questionに関連しています。

要件が変更されたため、同じタスクで Fiddler の拡張機能を使用する必要があります。

Fiddler によって除外される C# で拡張機能を作成するにはどうすればよいですか?

C#でdllを作成できます-古い.net 2.0コンパイラも試しました..最初にProgram-Fileフォルダーで拡張機能を使用し、次にMyDocumentsフォルダーで使用しようとしました(Fiddler-Websiteで言及されている2つ) .

Fiddler-extensions から extension-dll をダウンロードすると、Fiddler の再起動後に使用できます。

Fiddler が Windows を実行しているときに .dll ファイルを置き換えようとすると、.dll がプログラムによって使用されているため、現在は変更できないことが示されます。拡張機能は、拡張機能タブに表示されません。

他の誰もこの問題を抱えていないように見えるので、今私は何を探すべきか分からず、行き詰まっています。

多分これは私の質問に答えるために必要です:

使用: MS Visual C# 2008 Express Edition 私のプロジェクトは、さらに Fiddler と System.Windows.Forms にリンクされています (Fiddler で言及されている System.Windows.WinForms が見つかりませんでした)。

私の拡張機能で使用さ[assembly: Fiddler.RequiredVersion("2.2.7.0")]れ、私の Fiddler は 2.2.8.x です。

これが答えに興味がある場合:必要なコードを取得するためにIFiddlerExtension-Helpの説明も使用しました。

私の主な問題は、Fiddler がメモや失敗を教えてくれず、拡張機能を見つけたように見えるが、何らかの理由で使用できないことです。

    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) { }

    }


}

可能な限り助けていただければ幸いです...

4

1 に答える 1

2

IAutoTamper名前空間内でandインターフェイスを再宣言していIFiddlerExtensionます。これにより、Fiddler 名前空間内の実際のインターフェイスが「非表示」になります。

コードからこれらのインターフェイスの再宣言を削除すると (Violinクラスだけを残して)、DLL が問題なく動作することがわかります。

于 2010-02-24T01:14:45.510 に答える