Posted on: 11/14/2014 11:31:29 PM | Views : 419

Dear All,
i am trying to get the country name through ip address, however, 
public string GetCountry(string countryIP) { //string dottedip = ""; int pos, PrevPos = 0; int num; double Dot2LongIP = 0; CompareMethod Compare = CompareMethod.Text; for (int i = 1; i <= 4; i++) { pos = Strings.InStr(PrevPos + 1, countryIP, ".", Compare); if (i == 4) { pos = Strings.Len(countryIP) + 1; } num = Convert.ToInt32(Strings.Mid(countryIP, PrevPos + 1, pos - PrevPos - 1)); PrevPos = pos; Dot2LongIP = ((num % 256) * (Math.Pow(256, (4 - i)))) + Dot2LongIP; } string Country = ""; SqlConnection conn = new SqlConnection("Data Sour ...

Go to the complete details ...