Ban a user based on IP address

Submitted by:Jhon Smith

Date added:16 May, 2011


This code is an example of Ban a user based on IP address

Tags: ban user

Code Snippet:

'variables to store banned IP and the users IP
Dim strIP , strBannedIP
'this is the banned IP address
strBannedIP = ""
'get the users IP address
strIP = Request.ServerVariables("LOCAL_ADDR")
'if users address is the same as the banned IP address
'display a message
If strBannedIP = strIP Then
Response.Write "You are not permitted to view this website"
'if usersa ddress is different welcome message is displayed
Response.Write "welcome"
End If