Option Strict On does not allow narrowing in implicit type conversions between method and delegate

Error: Option Strict On does not allow narrowing in implicit type conversions between method 'context_beginRequest<ByVal sender As Object, ByVal e As WindowsAuthenticationEventArgs>' and delegate '<BeginRequest>'

For the code:

Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
    'context.
    AddHandler context.BeginRequest, New EventHandler(AddressOf context_BeginRequest)
End Sub

context_BeginRequest function::

Public Sub context_BeginRequest(ByVal sender As Object, ByVal e As WindowsAuthenticationEventArgs)
.....

..... End Sub

Jon Skeet
people
quotationmark

That's because HttpApplication.BeginRequest is just of type EventHandler... so your second parameter should be of type EventArgs, not WindowsAuthenticationEventArgs.

people

See more on this question at Stackoverflow