1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

IP Blocking

Discussion in 'C#' started by jeffrey78, Nov 28, 2010.

  1. #1
    How to block an IP from any country:confused:

    Thanks for your help in advance
     
    jeffrey78, Nov 28, 2010 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Google exactly that and you will find lots of examples of how to create a HTTP Handler to give a 403 error to any request coming from an IP that you want to block
     
    AstarothSolutions, Nov 29, 2010 IP
  3. gmybft

    gmybft Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    A simple way
    <%
    Dim sBlockedIP
    sBlockedIP = Request.ServerVariables("REMOTE_ADDR")
    'check if the IP is the one that is blocked
    If sBlockedIP = "32.454.42.12" Then
    'if IP address is banned then redirect to no_access.asp
    Response.Redirect "no_access.asp"
    End If
    %>
    Code (markup):
     
    gmybft, Nov 29, 2010 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    do you mean block an IP from a specific country? Otherwise you can block an IP regardless of the country that it belongs to.
     
    camjohnson95, Nov 30, 2010 IP
  5. r.pointing

    r.pointing Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Everybody
    Maintaining your own web presence is inevitably associated with potential external risks such as attack of malevolent users. The good news here is that you can easily recognize such malicious visitors, by checking the IP addresses that they are making a connection from.
     
    r.pointing, Dec 4, 2010 IP
  6. AcevedoAaron

    AcevedoAaron Peon

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i am agree with gmybft but are you sure to do that because it can decrease your traffic other wise you can use single IP blocking scripts i think its better
     
    AcevedoAaron, Dec 17, 2010 IP
  7. palme

    palme Active Member

    Messages:
    320
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Good ide gmybft , and script is fine if banned ip is from a pc and not from a site. you know an ip adress kan be also shared with may be more than 100 different sites url. and think if your site banned this ip then banned all of them. is it true?.
     
    palme, Dec 30, 2010 IP
  8. Sergei322

    Sergei322 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    A good idea, thanks gmybft
     
    Sergei322, Jan 8, 2011 IP
  9. gotlivechat

    gotlivechat Member

    Messages:
    516
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #9
    Are you talking about blocking an entire country's IP block? Or just a list? If you have a small list you can always list them in a DB and compare the web site visitor to the DB values. If you want to block entire country you can try using geolocation databases.
     
    gotlivechat, Jan 13, 2011 IP
  10. nuare

    nuare Member

    Messages:
    49
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #10
    use GeoIP api to determine the country according to REMOTE_ADDR, and block them as gmybft suggested
     
    nuare, Jan 20, 2011 IP