This is a small function that will block the specific IP from viewing the certain page, and it will redirect the user to the main page or noaccess page.
Blocking an IP adress to a certain page
<%
'''''''''''''''''''''''''''''''
' Block the IP addresses that do the SPAM
'''''''''''''''''''''''''''''''
Function IsBlockedIP()
Dim UserIP
Dim BlockedIParray(2)
'assign our blocked IP addresses to our array
BlockedIParray(0) = "60.0.201.209"
BlockedIParray(1) = "218.11.15.212"
'retrieve the visitors IP address
UserIP = Request.ServerVariables("REMOTE_ADDR")
'loop through the Blocked IPs
For i = 0 to UBound(BlockedIParray)
If UserIP = BlockedIParray(i) Then
Response.Redirect "index.asp"
'Response.Redirect "noaccess.asp"
End If
Next
End Function
%>
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.