Results 1 to 4 of 4

Thread: Blocking IP addresses from using the site

  1. #1
    Join Date
    Feb 2005
    Posts
    153
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Default Blocking IP addresses from using the site

    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?

  2. #2
    Join Date
    Jan 2005
    Location
    Cardiff
    Posts
    449
    Thanks
    10
    Thanked 17 Times in 17 Posts

    Default

    .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
    %>


  3. #3
    Join Date
    Feb 2005
    Posts
    153
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Default

    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?

  4. #4
    Join Date
    Jan 2006
    Posts
    419
    Thanks
    2
    Thanked 16 Times in 16 Posts

    Default

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Site up time
    By Spire in forum Technical Support
    Replies: 4
    Last Post: 1st June 2006, 10:30 AM
  2. Accessing site before DNS Moved
    By benhall in forum General Technical Support
    Replies: 3
    Last Post: 21st January 2006, 09:03 PM
  3. I monitored my site with Alertra
    By terraqueotenaz in forum Customer Feedback and Suggestions
    Replies: 6
    Last Post: 27th February 2005, 11:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •