Do you see anything wrong with this code?
-
The value is in the cache for more than a minute, does it have something to do with the datatype being saved? I already tryed utcnow but the result is the same, and also, i tryed using a timespan of 1 minute and guess what... not working either, i dont think its my machine, because it doent work either on my server If you have the time, check it please I know i could use the NoBot control in ajax but i really want to know whats wrong with this
Private Function IsRobot() As Boolean
Dim IP As String = Me.Request.UserHostAddress
Dim key As String = "Contact_" & IP
Dim obj As Object = Cache(key)
Dim Counter As Integer = 0
If obj Is Nothing Then
Cache.Insert(key, Counter, Nothing, Now.AddMinutes(1), Cache.NoSlidingExpiration)
Else
Counter = obj
End If
If Counter >= 5 Then
Me.lblError.Text = "Too many emails"
Me.lblError.Visible = True
Return True
End If
Cache(key) = Counter + 1
Return False
End FunctionThanks for your time
Alexei Rodriguez