gpt4 book ai didi

asp.net - 编译错误 - 与委托(delegate)没有相同的签名

转载 作者:行者123 更新时间:2023-12-02 20:36:58 26 4
gpt4 key购买 nike

不知道我做错了什么......

BC30408: Method 'Protected Sub ValidateUser(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub AuthenticateEventHandler(sender As Object, e As System.Web.UI.WebControls.AuthenticateEventArgs)'.

出现错误

<asp:Login ID="Login1" runat="server" OnAuthenticate="ValidateUser">

有关错误的详细信息。

Microsoft (R) Visual Basic Compiler version 8.0.50727.5420 for Microsoft (R) .NET Framework version 2.0.50727.5420 Copyright (c) Microsoft Corporation. All rights reserved.

C:\inetpub\wwwroot\Login.aspx(43) : error BC30408: Method 'Protected Sub ValidateUser(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub AuthenticateEventHandler(sender As Object, e As System.Web.UI.WebControls.AuthenticateEventArgs)'.

        AddHandler __ctrl.Authenticate, AddressOf Me.ValidateUser
~~~~~~~~~~~~~~~ C:\inetpub\wwwroot\Login.aspx(43) : error BC30408: Method 'Protected

Sub ValidateUser(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub AuthenticateEventHandler(sender As Object, e As System.Web.UI.WebControls.AuthenticateEventArgs)'.

        RemoveHandler __ctrl.Authenticate, AddressOf Me.ValidateUser
~~~~~~~~~~~~~~~

最佳答案

错误消息之前有一条线索:

Microsoft (R) Visual Basic Compiler version 8.0.50727.5420 for Microsoft (R) .NET Framework version 2.0.50727.5420 Copyright (c) Microsoft Corporation. All rights reserved.

这是一个古老的(2005 年!)版本的 VB 编译器,可能不处理委托(delegate)差异。虽然您可以更改方法的签名,但最好让本地计算机使用更新版本的 VB 编译器。我的猜测是,这是 IIS 为您进行编译,因此您基本上需要编辑 IIS 设置。 (我不是 ASP.NET 专家,所以我无法告诉您具体在哪里执行此操作,但希望这足以让您继续前进。)

老实说,我很惊讶这是您遇到的唯一问题 - 使用该版本的 VB,您将没有 LINQ...

关于asp.net - 编译错误 - 与委托(delegate)没有相同的签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37519532/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com