ASP Code

Block visitors based on IP address with ASP

I previously posted this code in PHP, and I thought it would be handy to have the ASP alternative, in case you need to block visitors or known spammers based on their IP address.

Function IsBlockedIP()
	Dim UserIP 
	Dim BlockedIParray(2)  ' you can create the array larger of course
	'put each blocked IP address in the array
	BlockedIParray(0) = "" 
	BlockedIParray(1) = "" 
	'retrieve the visitors IP address from the server variables
	UserIP = Request.ServerVariables("REMOTE_ADDR") 
	'loop through the Blocked IPs 
	For i = 0 to UBound(BlockedIParray) 
		If UserIP = BlockedIParray(i) Then 
			Response.Redirect "blocked.asp" 
		End If 
End Function


  1. dfdfdfdfdfdfdf

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image