Convert C # to vb.net "RaiseEvent" to create an event to use Gzip

I have a class conversion from C # to vb.net. My point is that I want to compress an asp.net page to reduce page size. The problem is that I am converting to vb.net, I have this error.

Description: An error occurred while compiling the resource required to service this request. Review the following specific error details and modify the source code accordingly.

Compiler Error Message: BC32022: "Public event PostRequestHandlerExecute (sender as object, e As System.EventArgs) 'is an event and cannot be called directly. Use the" RaiseEvent "operator to create the event.

Source Error:

Line 178:

Line 179: Private Sub Init (context as HttpApplication) Implements IHttpModule.Init

Line 180: context.PostRequestHandlerExecute + = New EventHandler (context_BeginRequest)

Line 181: End Sub

Line 182:

im trying to implement gzip for asp.net ... thanks in advance ....

+6
source share
2 answers

AddHandler is the equivalent of VB.NET for C # s += when used in events.

 AddHandler context.PostRequestHandlerExecute, AddressOf context_BeginRequest 
+16
source

You need to use the AddHandler operator, not += . this is c# syntax.

 AddHandler context.PostRequstHandlerExecute, New EventHandler(AddressOf context_BeginRequest) 
+5
source

All Articles