根据在浏览器中输入的地址,获得IP 根据在浏览器中输入的地址,判断是中国的还是美国的,麻烦各位帮忙看下。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/nova_zhang/archive/2010/05/13/1734344.html 查看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()) {} 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段:…… 关于MVC中传值的问题 sql和WIDOWS身份验证 关于calendar控件的隐藏问题. 如何改变网页中的链接的文本!!!!!!!!!!!!!!!!!! 如何用sql新建数据库 有没有方法使用System.Web.UI.PageHandlerFactory? 100分!长跪哭求: asp.net vb版的html在线编辑器完全项目源代码 急!最后40分,datagrid里怎样增加按钮事件 发一百分对这边文章谴责! Microsoft JScript 运行时错误: 没有权限 关于ASP.NET页面缓存的一些问题 C++和JAVA哪个前景好。。
通过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())
{}
中国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段:……