首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FiddlerCore in VB.net?

FiddlerCore in VB.net?
EN

Stack Overflow用户
提问于 2011-04-04 00:52:47
回答 1查看 1.5K关注 0票数 1

有人知道如何在FiddlerCore中使用vb.net吗?我曾经使用过一些C#到vb.net工具,但他们永远无法将其转换为有效的工具。代码示例(甚至是完整的项目)或站点引用将是很好的。

如果可以的话,谢谢!

-Hopeless。

-编辑--

我有下面的代码,我已经适应了(从下面一篇精彩的文章)。然而,这似乎不起作用。

代码语言:javascript
复制
Private Sub StartProxy()

    If Not FiddlerApplication.IsSystemProxy Then
        AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler
        AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler
    End If

    FiddlerApplication.Startup(80, True, False, False)

End Sub

Private Sub FiddlerBeforeRequestHandler(ByVal tSession As Session)
    RichTextBox1.Text &= "REQUEST:  " & tSession.fullUrl & vbCrLf
End Sub

Private Sub FiddlerBeforeResponseHandler(ByVal tSession As Session)
    RichTextBox1.Text &= "RESPONSE:  " & tSession.fullUrl & vbCrLf
End Sub



Private Sub StopProxy()

    Try
        RemoveHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler
        RemoveHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler
        FiddlerApplication.Shutdown()
    Catch ex As Exception
    End Try

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    StartProxy()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    StopProxy()
End Sub
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-04 22:24:13

C#应该是容易转换的故障。但是..。啊好吧..。这里有一个小样本:

代码语言:javascript
复制
    Private Sub StartProxy()

        If Not FiddlerApplication.IsSystemProxy Then
            AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler
            AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler
        End If

        FiddlerApplication.Startup(8090, True, False, False)

    End Sub

Private Sub FiddlerBeforeRequestHandler(ByVal tSession As Session)
  ' Code to process the request before it is passed along to the next server in the request chain.
End Sub

Private Sub FiddlerBeforeResponseHandler(ByVal tSession As Session)
  ' Code to process the response before passing along to the next client in the response chain (typically the browser)
End Sub



Private Sub StopProxy()

        Try
            RemoveHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler
            RemoveHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler
            FiddlerApplication.Shutdown()
            System.Threading.Thread.Sleep(500)
        Catch ex As Exception
        End Try

    End Sub
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5533615

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档