根据IP地址返回IP的详细信息(Web Service)

接口:http://www.sz3w.net/Service/GetIPArea.asmx?op=GetSignIPArea

       protected void Button1_Click(object sender, EventArgs e)
        {
            int pagesize = Convert.ToInt32(PageSize.Text.ToString());
            int pageindex = Convert.ToInt32(PageIndex.Text.ToString());
            List<Vote> votes=DBHELP.QueryList(pagesize, pageindex);
            if (votes != null)
            {
                ServiceIP.GetIPArea getip = new GetIPArea();


                foreach (Vote v in votes)
                {

                    string msg = getip.GetSignIPArea(v.IP);
                    if (msg.Substring(4, 2) == "-1")
                    {
                        v.IPaddress = "无效IP";
                    }
                    else
                    {
                        string[] strs = msg.Split('|');
                        v.IPaddress = strs[0].Substring(8) + strs[2].Substring(5);
                    }
                    DBHELP.DataUpdate(v);
                }
                Label1.Text = "执行完成!";
            }
            else
            {
                Label1.Text = "没有数据了!";
            }
        }

上述是我做的ip转ip详细的代码,部分看不懂关系,看关键代码就可以

原文地址:https://www.cnblogs.com/zwnet/p/2663831.html