I have a login page where I want to lockout a user if their attempts > 3 with the wrong username/password
I've added a int field to my tblUsers table that I can set to 1 if they need to be locked out...I just need the code that does it
The login code I'm using is below...
If dR("UserName") = Trim(strUserName.Text) And dR("UserPassword") = Trim(strUserPassword.Text) Then
FormsAuthentication.Initialize()
Dim value As Integer = 0
Dim isPersistent As Boolean = True
Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, strUserName.Text, DateTime.Now, DateTime.Now.AddHours(1), isPersistent, strUserName.Text, FormsAuthentication.FormsCookiePath)
Dim hash As String = FormsAuthentication.Encrypt(ticket)
Dim cookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, hash)
'''BLAH...BLAH...BLAH''' NAME SOME SESSION VARIABLES... '''BLAH...BLAH...BLAH'''
dR.Close()
Dim oCom2 As SqlCommand = New SqlCommand
oCom2.Connection = objConn
Dim sSQL As String
sSQL = "Update dbo.tblUsers "
sSQL = sSQL & "Set LastLogin = '" & System.DateTime.Now & "'"
sSQL = sSQL & " where UserID=" & CInt(Session("UserID"))
Response.Write(sSQL)
oCom2.CommandText = sSQL
oCom2.ExecuteNonQuery()
oCom2.Dispose()
FormsAuthentication.RedirectFromLoginPage(Session("UserID"), False)
Select Case CStr(Session("GroupDesc"))
Case "Management", "Office Assts", "Administrator"
DO SOME STUFF
Case "Broker", "Sales"
DO SOME STUFF
Case "Agent"
DO SOME STUFF
Case Else
DO SOME STUFF
End Select
End If
Else
lblError.Visible = True
lblError.Text = "Username/Password Incorrect"
End If