what is the best way to block an IP address or a range of addresses from viewing my website?
Ive heared it can be done using a .htaccess file? is this the best way?
or, is there a simple little script I can put (using asp) into the top of my pages?
what is the best way to block an IP address or a range of addresses from viewing my website?
Ive heared it can be done using a .htaccess file? is this the best way?
or, is there a simple little script I can put (using asp) into the top of my pages?
.htaccess is linux only but you could use ASP:
Code:<% Dim IP_truth ' requesting the Visitors IP address IP_truth = request.servervariables("REMOTE_ADDR") ' Dim the number of IP's we are blocking Dim NumberOf 'The number of IP's to be blocked NumberOf = 3 ' Dim the Array , the number MUST be the same as the above variable. Dim Ip_array(2) ' We give values to the Array Ip_array(0) = "83.245.63.3" Ip_array(1) = "127.0.0.1" Ip_array(2) = "64.233.167.99" Ip_array(3) = "216.239.57.104" For I = 0 to NumberOf If Ip_array(I) = IP_truth then Response.write "Sorry your IP address has been banned!" Response.End End If next %>
ok thanks, but what about a range of IP's?
the one specific one I want to block from a pesky member the 4th (last) block of numbers change each time they login
for example sometimes its 193.133.92.239
and sometimes its 193.133.92.229 and so on.
Can I use a wildecard or something?
You could specify in a config section of your app an ip address and sub net mask and use such information to calculate from the ip address and sub net mask of the ip addresses to be blocked. You could extend this to multiple ip addresses and sub net masks.
In iis you can configure who can access a site if you have access to this and you may be able to specify this now in the web.config if you are building a .net web app.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks