Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8518151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:54:10+00:00 2026-06-11T05:54:10+00:00

I have a method named getIP() which returns the clients ip as a string.

  • 0

I have a method named getIP() which returns the clients ip as a string.

How do I use this IP to get the location of the client using this service.

This is how i show the clients IP address.

string IP = getIP();
lblIPAddress.Text = "IP " + IP;

How do i include the clients location in ?

i.e. lblIPAddress.Text = "IP " + IP+ "location" ;)  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:54:12+00:00Added an answer on June 11, 2026 at 5:54 am

    Below you can find a very simple snippet which I was using to get data from XML endpoint of that API some time ago (I believe there was no changes to the API so it still should work):

    string city;
    string country;
    string countryCode;
    decimal longitude;
    decimal latitude;
    
    XmlTextReader hostIPInfoReader = new XmlTextReader("http://api.hostip.info/?ip=" + IP);
    while (hostIPInfoReader.Read()) {
        if (hostIPInfoReader.IsStartElement()) {
            if (hostIPInfoReader.Name == "gml:name")
                city = hostIPInfoReader.ReadString();
    
            if (hostIPInfoReader.Name == "countryName")
                country = hostIPInfoReader.ReadString();
    
            if (hostIPInfoReader.Name == "countryAbbrev")
                countryCode = hostIPInfoReader.ReadString();
    
            if (hostIPInfoReader.Name == "gml:coordinates") {
                string[] coordinates = hostIPInfoReader.ReadString().Split(new char[] { ',' });
                longitude = decimal.Parse(coordinates[0]);
                latitude = decimal.Parse(coordinates[1]);
            }
        }
    }
    

    This code can be of course improved but I believe it`s a good starting point for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method named InitializeCRMService() which returns an object of IOrganizationService . Now
I have a method named RenderContent which returns object[] In my unit test, I
I have a log method which saves to a file that is named the
I have a custom class named CatalogItem which I receive in a method, as
This is a client-server programm. For each client server has a method, which checks
I have a method named raise_alarm() which, show a message box based on jquery.
I have a method named GetOrders . This method reads an XML file and
I have two class files hudlayer.m and actionlayer.m I have a method named jump
I have a Silverlight control with a method named DoSomething() decorated with the <ScriptableMember()>
Welcome! I have a recursive public static method named less that takes a tree

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.