0
Private Sub CheckLogin()

If Failed == 3
    'show recapacha
    If Page.IsValid Then
    CheckLogin2()
    End If
End If
Else
Try
    'login code
    ' on password fail Failed+1
End Try
End If

我拥有的是一个登录表单,但我不想在有 3 次无效登录尝试之前显示 recapacha。我不确定最好的方法。以上是一些样机代码,可以了解我的前进方向。

4

1 回答 1

0
Private Sub CheckLogin()

    'after the three attempts 
    If (LoginCount = 3) Then
        'show captcha code
        Return
    End If
    'your login code if found unsuccessful increase the counter
    LoginCount += 1

End Sub

增加计数器并检查登录尝试次数的属性

Public Property LoginCount() As Integer
    Get
        If (ViewState("LoginCount") = Nothing) Then
            ViewState("LoginCount") = 0
        End If
        Return DirectCast(ViewState("LoginCount"), Integer)
    End Get
    Set(ByVal value As Integer)
        ViewState("LoginCount") = value
    End Set
End Property
于 2012-04-12T15:57:27.127 回答