判断本机ip是电信还是网通
2016-02-19 13:27
453 查看
string location = "0";//0是网通 1是电信 Uri uri = new Uri("http://www.ip138.com/ips138.asp"); System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri); req.Method = "get"; using (System.IO.Stream s = req.GetResponse().GetResponseStream()) { using (System.IO.StreamReader reader = new System.IO.StreamReader(s,Encoding.GetEncoding("gb2312"))) { string str = reader.ReadToEnd(); if (str.Contains("电信")) { location = "1"; } } }
相关文章推荐
- Redis-benchmark命令测试Redis性能
- Greenplum安装准备
- 为什么 NSString 要用 copy 修饰,而不是 retain
- Java设计模式透析之 —— 组合(Composite)
- LightOJ 1282 Leading and Trailing(n阶的前三位,后三位)
- Oracle笔试题
- textfield详解
- 知名网络安全公司
- ssh两台机器建立信任关系无密码登陆
- Google Hacking技术
- php多处require_once 函数重名错误
- GCD常见用法
- 爱因斯坦论教育
- 关于Interface忽然想到的
- Intent中的四个重要属性——Action、Data、Category、Extras
- Java设计模式透析之 —— 适配器(Adapter)
- Linux的cron与%
- GitLab使用方法
- android FM搜索频率流程
- [转]x64 PL/SQL 连接 Oralce 提示 Could not initialize oci.dll