Option Strict On不允许缩小方法和委托之间的隐式类型转换

时间:2015-07-22 19:47:56

标签: vb.net ihttpmodule

错误:Option Strict On不允许缩小方法'context_beginRequest<ByVal sender As Object, ByVal e As WindowsAuthenticationEventArgs>'和委托'<BeginRequest>'

之间的隐式类型转换

代码:

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函数::

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

..... 结束子

1 个答案:

答案 0 :(得分:0)

这是因为HttpApplication.BeginRequest只是EventHandler类型...所以你的第二个参数应该是EventArgs类型,而不是WindowsAuthenticationEventArgs