It took me a long time to find this bug.
It turned out to be the Session_End that was triggered and Session variables was lost.
Having realized that the bug was due to firing Session_End in the middle of the app the bug could not hide!
' Administrator will only be allowed a certain number of login attempts
Session("MaxLoginAttempts") = 3
Session("LoginCount") = 0
' Track whether they're logged in or not
Session("LoggedIn") = "No"
Dim intTotal_visitors As Integer
'set timeout to 20 mins
Session.Timeout = 1
Session("Start") = Now
Application("UseCookies") = "yes"
'increase count by 1
Application("visits") = Application("visits") + 1
intTotal_visitors = Application("visits")
Session("VisitorID") = intTotal_visitors
Session timeout should normaly be 20 min, but for some reason it was set to 1 min.
How stuppid can a programmer be? ME!
Thanks for watching