asp 如何禁止国内的IP访问我的网站 我的网站是英文的
asp 如何禁止国内的IP访问我的网站 我的网站是英文的 不想让国内的访问 有什么好办法
<% Function leleToStr(str) Dim stream Set stream=Server.CreateObject("ADODB.Stream") With stream .Type=1 .Mode=3 .Open .Write str .Position = 0 .Type = 2 .Charset = "gb2312" leleToStr = .ReadText .Close End With Set stream=Nothing End Function '获取IP所在地区 Function getIPAddress() on error resume next dim xmlhttp,url url = "http://ip." set xmlhttp = server.CreateObject("Msxml2.XMLHTTP") xmlhttp.open "get",url,false xmlhttp.send '开始截取字符 dim StartStr,EndStr,html html = leleToStr(xmlhttp.responseBody) StartStr = Instr(html,"所在地为:") EndStr = Instr(html,"如果该IP") html = mid(html,StartStr,EndStr-StartStr) '再次获取 StartStr = Instr(html,"<span>") StartStr = StartStr + 6 EndStr = Instr(html,"</span>") html = mid(html,StartStr,EndStr-StartStr) getIPAddress = html if err then err.clear:html = "" set xmlhttp = nothing End Function if Instr(getIPAddress(),"中国")>0 then response.end %>