Block Multiple IP Addresses

Submitted by:Jhon Brain

Date added:20 March, 2013

Category:ASP

ASP code example to block Multiple IP Addresses

Tags: block ip

Code Snippet:

    <%
'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"
sIParray(2) = "127.0.0.3"
'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 "no_access.asp"
End If
Next
%>
 
 

Comments