Find Country from URI


First Add the Service reference  :  http://www.webservicex.com/geoipservice.asmx?WSDL



IPAddress[] address = Dns.GetHostAddresses(textBox1.Text);

            string[] array =new string[address.Count()];
            int i=0;
            foreach (IPAddress item in address)
            {
                array[i] = item.ToString();
            }
            textBox2.Text = array[0].ToString();
            ServiceReference1.GeoIPServiceSoapClient cl = new ServiceReference1.GeoIPServiceSoapClient();
            ServiceReference1.GeoIP gp = cl.GetGeoIP(array[0].ToString());
            textBox3.Text = gp.CountryName + " : " + gp.CountryCode;


Comments

Popular posts from this blog

Encrypt and Decrypt text using alphabet shifting method

Gridview to Datatable and Viewstate

You think Creating Circuler Graph is a difficult task ...........!!!