How to detect if the page is being opened by a real user and not a crawler
In one project I need to tally the number of people opening a product page and store it in a database on the server side.
To make sure we are not adding the visits by various crawlers I digged out an old code I had for that purpose. As it is pretty old I am wondering if it is up to date.
What do you think?
If CheckBrowserCaps() = True Then
' ..... do the database part
End If
Function CheckBrowserCaps() As Boolean
CheckBrowserCaps = True
Dim labelText As String = ""
Dim myBrowserCaps As System.Web.HttpBrowserCapabilities = Request.Browser
If (CType(myBrowserCaps, System.Web.Configuration.HttpCapabilitiesBase)).Crawler Then
CheckBrowserCaps = False
Else
CheckBrowserCaps = True
End If
End Function