测试IP:121.14.88.14
测试IP来源:运行—>CMD ——>ping http://www.baidu.com/
操作 步骤
选中你的项目 右键添加web引用:http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx 前往
引用那里改好名字 你需要当做命名空间调用
然后就是下面的代码
图片在附件里面
1调用网络WebService获取IP地址信息using GetIP;//这个命名空间是在添加引用的时候自己写的
2调用网络WebService获取IP地址信息IpAddressSearchWebService IpSearch = new IpAddressSearchWebService();//IpAddressSearchWebService是添加引用的里面的一个类
3调用网络WebService获取IP地址信息        string [] infos = IpSearch.getCountryCityByIp(this.TextBox1.Text);//调用getCountryCityByIp返回string数组 第一个为IP 第二个为IP地址的地址
4调用网络WebService获取IP地址信息        Response.Write("你输入的IP是:" + infos[0+ "</br>IP地址所在地是:" + infos[1+ "");

更多参考:http://www.92dotnet.com/showtopic-470.aspx

相关文章: