C#编程获取IP地址或网站域名归属地
1、打开VS2010,设计软件界面

3、 /// <summary> /// 获取IP归属地 /// </summary> /// <param name="strIP">IP地址</param> /// <returns>IP归属地</returns> private string GetIPAdress(string strIP) { string s = getHtml("http://www.ip138.com/ips1388.asp?ip=" + strIP + "&action=2"); int a = s.IndexOf("本站主数据:") + "本站主数据:".Length; int b = s.IndexOf("参考数据一"); return s.Substring(a, b - a).Replace("</li><li>", ""); }

5、调试运行,修改错误
