根据在浏览器中输入的地址,
判断是中国的还是美国的,
麻烦各位帮忙看下。。

解决方案 »

  1.   

    http://www.cnblogs.com/nova_zhang/archive/2010/05/13/1734344.html
      

  2.   

    查看IP数据库
    通过httpwebrequest,查询ip138
    如byte[] bs = Encoding.ASCII.GetBytes("ip=&action=2");   
    HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create( "http://www.ip138.com/ips.asp" ); 
    req.Method = "POST";   
    req.ContentType = "application/x-www-form-urlencoded";   
    req.ContentLength = bs.Length;   
    using (Stream reqStream = req.GetRequestStream())   
    {} 
      

  3.   

    string _ipAddress = Request.UserHostAddress;然后根据获得的IP处理,增加一个方法判断是否在如下范围内
    中国IP段:202.98.106.0 - 202.98.106.63 202.96.174.0 - 202.96.175.255 202.96.214.192 - 202.96.214.255 202.96.214.128 - 202.96.214.191 202.96.214.64 - 202.96.214.127 202.102.18.128 - 202.102.18.159 202.96.17
    美国IP段:……