0

我试过了,但我收到了这个错误:

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30201: Expression expected.

Source Error:

Line 26:            password.Text = parseQuery("pass")
Line 27:        End If
Line 28:        If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)
Line 29:    End If
Line 30:    


Source File: C:\Inetpub\wwwroot\devv\login.aspx.vb    Line: 28
4

2 回答 2

3

尝试将您的陈述更改为阅读

If password.Text <> "" And username.Text <> "" Then 
   btnLogin_Click(Nothing, Nothing)
End If

您当前的代码正在使用签名,就好像您正在创建按钮单击事件一样,您只需将一些虚拟参数传递给该方法,前提是它已被编写。

但是,如果您通过各种方法触发登录,我建议您编写第二种方法,称为 ProcessLogin 或类似的东西,并让您的按钮单击事件简单地重定向到那里。这将使您的登录处理更容易拥有多个“入口向量”。

于 2009-08-14T23:01:30.580 回答
0

您需要将第 28 行从

If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)

If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Nothing, EventArgs.Empty)
于 2009-08-14T23:04:32.913 回答