This is a very simple programme that demonstrate how to block specified IP addresses from accessing the website or webpages. In this code I used array to store the IP adresses but database can also be used to store the IP adresses. You can redirect the user to a specified page of restrict it to specified pages or no access pages.

'*******************************************************
'*     MYCPLUS Sample Code - https://www.mycplus.com     *
'*                                                     *
'*   This code is made available as a service to our   *
'*      visitors and is provided strictly for the      *
'*               purpose of illustration.              *
'*                                                     *
'* Please direct all inquiries to saqib at mycplus.com *
'*******************************************************


'********************************
' Block the IP addresses that do the SPAM
'********************************

Function IsBlockedIP()
'declare variables
Dim sIP
Dim sIParray(2)
'assign our blocked IP addresses to our array
sIParray(0) = "127.0.0.1"
sIParray(1) = "127.0.0.2"

'retrieve the visitors IP address
sIP = Request.ServerVariables("REMOTE_ADDR")
'loop through the banned IPs using the UBound function
For i = 0 to UBound(sIParray)
'check if IP address matches any of the blocked IPs
if sIP = sIParray(i) Then
Response.Redirect "index.asp"
End if
Next
End Function