Hi, i want to block a country ip for my web site. i dont want this country ip's visitors to visit my web site. i want then to redirect to another site. my web site is . ASP. i need a simple code..please help Thanks
The following code should work for ASP. To get the lit of c-classes you want to block, try using the tool at www.blockacountry.com. Dim BlockedIPs, VisitorIP BlockedIPs = Array("66.128.32.","66.231.64.","157.253.0") 'List of blocked C classes VisitorIP = " " & Request.ServerVariables("REMOTE_ADDR") 'Visitor's IP address For Each IP in BlockedIPs If (InStr(VisitorIP,IP) > 0) Then Response.Redirect("www.newsite.com") End If Next Code (markup):
Make sure you are wrapping the code in <% and %> and put the script at the top of the page. If that still doesn't work, please let me know what the error is.