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

  • SEARCH
  • Home
  • 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 5990009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:10:57+00:00 2026-05-22T23:10:57+00:00

I have a computer on the local network, behind a NAT router. I have

  • 0

I have a computer on the local network, behind a NAT router. I have some 192.168.0.x addresses, but I really want to know my public IP address, not something mentioned in

How to get the IP address of the server on which my C# application is running on?

or

How to get the IP address of a machine in C#

I need C# code.

Is it possible? If so, how?

  • 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-05-22T23:10:58+00:00Added an answer on May 22, 2026 at 11:10 pm

    After some search, and by expanding my requirements, I found out that this will get me not only the IP, but GEO-location as well:

    class GeoIp
    {
        static public GeoIpData GetMy()
        {
            string url = "http://freegeoip.net/xml/";
            WebClient wc = new WebClient();
            wc.Proxy = null;
            MemoryStream ms = new MemoryStream(wc.DownloadData(url));
            XmlTextReader rdr = new XmlTextReader(url);
            XmlDocument doc = new XmlDocument();
            ms.Position = 0;
            doc.Load(ms);
            ms.Dispose();
            GeoIpData retval = new GeoIpData();
            foreach (XmlElement el in doc.ChildNodes[1].ChildNodes)
            {
                retval.KeyValue.Add(el.Name, el.InnerText);
            }
            return retval;
        }
    }
    

    XML returned, and thus key/value dictionary will be filled as such:

    <Response>
        <Ip>93.139.127.187</Ip>
        <CountryCode>HR</CountryCode>
        <CountryName>Croatia</CountryName>
        <RegionCode>16</RegionCode>
        <RegionName>Varazdinska</RegionName>
        <City>Varazdinske Toplice</City>
        <ZipCode/>
        <Latitude>46.2092</Latitude>
        <Longitude>16.4192</Longitude>
        <MetroCode/>
    </Response>
    

    And for convenience, return class:

    class GeoIpData
    {
        public GeoIpData()
        {
            KeyValue = new Dictionary<string, string>();
        }
        public Dictionary<string, string> KeyValue;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a django app on my local computer for some
I want to host a website on my local network. For some reason I
I have an application which communicates over the local area network. However, I want
I have the whole setup working for months on my local computer. I'm installing
I have repository on GitHub to which I commit regularly from my local computer.
I have got a page which lets me control some devices in a local
I have a server running on the network my computer is on. Is there
I have a ubuntu server,which is within a local network of a company, and
I have one problem. I have EasyPHP server on my local computer. I am
I have 41 computers that used MPI on the same local area network. MPI

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.