-
Jun 10th, 2021, 01:51 PM
#1
Thread Starter
Junior Member
[Build] Cannot be called directly Error
My source code is as below. I get an error when trying to debug and I can't solve this error in any way.
Please enlighten me with your knowledge, masters.
Error BC32022 Public Shared Event ResponseHeadersAvailable As SessionStateHandler' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
Error BC32022 Public Shared Event BeforeResponse As SessionStateHandler' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
My Source Code:
Code:
Imports Fiddler
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Namespace FiddlerCore_ModifyResponse
Class Program
Private Shared Async Function Main(ByVal args As String()) As Task
FiddlerApplication.Prefs.SetBoolPref("fiddler.certmaker.bc.Debug", True)
Dim certProvider As BCCertMaker.BCCertMaker = New BCCertMaker.BCCertMaker()
CertMaker.oCertProvider = certProvider
'THERE IS A PROBLEM
FiddlerApplication.ResponseHeadersAvailable += AddressOf FiddlerApplication_ResponseHeadersAvailable
Fiddler.FiddlerApplication.BeforeResponse += AddressOf FiddlerApplication_BeforeResponse
If Not CertMaker.createRootCert() Then
Console.WriteLine("Unable to create cert for FiddlerCore.")
Return
End If
If Not CertMaker.trustRootCert() Then
Console.WriteLine("Unable to install FiddlerCore's cert.")
Return
End If
Dim startupSettings As FiddlerCoreStartupSettings = New FiddlerCoreStartupSettingsBuilder().ListenOnPort(8887).DecryptSSL().RegisterAsSystemProxy().Build()
FiddlerApplication.Startup(startupSettings)
Console.ReadKey()
FiddlerApplication.Shutdown()
End Function
Private Shared Sub FiddlerApplication_BeforeResponse(ByVal oSession As Session)
If oSession.fullUrl.Contains("raw.githubusercontent.com/3xynos/Valorous/main/zortlattim") AndAlso oSession.HTTPMethodIs("GET") Then
oSession.bBufferResponse = True
oSession.utilDecodeResponse()
oSession.utilDecodeResponse()
Dim oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes)
oBody = "Dnspy Adamdır [1]!"
oSession.utilSetResponseBody(oBody)
End If
End Sub
Private Shared Sub FiddlerApplication_BeforeResponse2(ByVal oSession2 As Session)
If oSession2.fullUrl.Contains("raw.githubusercontent.com/3xynos/Valorous/main/update") AndAlso oSession2.HTTPMethodIs("GET") Then
oSession2.bBufferResponse = True
oSession2.utilDecodeResponse()
oSession2.utilDecodeResponse()
Dim oBody2 = System.Text.Encoding.UTF8.GetString(oSession2.responseBodyBytes)
oBody2 = "Dnspy Adamdır [2]!"
oSession2.utilSetResponseBody(oBody2)
End If
End Sub
Private Shared Sub FiddlerApplication_ResponseHeadersAvailable(ByVal oSession As Session)
If oSession.fullUrl.Contains("testsite.com/test1.php") Then
oSession.bBufferResponse = True
End If
End Sub
Private Shared Sub FiddlerApplication_ResponseHeadersAvailable2(ByVal oSession As Session)
If oSession.fullUrl.Contains("testsite.com/test2.php") Then
oSession.bBufferResponse = True
End If
End Sub
End Class
End Namespace
-
Jun 10th, 2021, 03:04 PM
#2
Thread Starter
Junior Member
Re: [Build] Cannot be called directly Error
i solved problem
VB.NET has an AddHandler method that works similarly to the way the '+' overload operator works for adding event handlers in C#. There's no '+' used that way in VB. You specify the event you want to capture and the handler to fire when it occurs:
You'd call it roughly like so:
AddHandler FiddlerApplication.ResponseHeadersAvailable, AddressOf FiddlerApplication_ResponseHeadersAvailable
AddHandler Fiddler.FiddlerApplication.BeforeResponse, AddressOf FiddlerApplication_BeforeResponse
-
Jun 10th, 2021, 07:41 PM
#3
Re: [Build] Cannot be called directly Error
If your issue is resolved then please use the Thread Tools menu to mark the thread Resolved. That way, we know that you don't need any more help without opening the thread and reading the whole thing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|