Switch to full style
ASP/ASP.net examples
Post a reply

ban visitor from a specific IP-address

Sun Apr 03, 2011 11:00 pm

Following code ban visitor from a specific IP-address to view your page content .
Code:
<% 
'variables to store banned IP and the users IP 
Dim strUserAddress , strBlockedIP
'
 just imagine that this is a banned IP address 
strBlockedIP
= "147.3.3.1" 
' retrieve the user IP address , 
strUserAddress = Request.ServerVariables("LOCAL_ADDR") 
'
if page visitor address equals to banned IP address 
'condition and print error message for visitor .
If strBlockedIP= strUserAddress Then 
Response.Write "Error : Your IP address is not allowed to see this page." 
'
If IP address is not banned.
Else 
Response
.Write "<b>Page content </b>" 
End If 
%>
 




Re: ban visitor from a specific IP-address

Mon Jan 02, 2012 6:51 pm

What if want to allow specific IP to view and specific page? :duel:

Post a reply
  Related Posts  to : ban visitor from a specific IP-address
 log visitor IP address.     -  
 Specific Colors for Specific Forum     -  
 Display Visitor's Local Time (IPv6 supported)     -  
 what is MAC address     -  
 Reading a Specific Character in php     -  
 how to get Color name from a specific pixel ??     -  
 Get IP address code     -  
 Find MAC Address     -  
 change the MAC address     -  
 Get Server address     -  

Topic Tags

ASP Networking