Hi,

I want to get the External IP address in console application using C#.net.
External IP is different from local machine IP.

any help?

Thanks

what do you mean by External IP? Lan IP or Public IP?

I'll assume he means public IP (Modem IP)

Unfortunately, the only real way you can do this is to query an external service and ask it. Your modem/router might have something you can query for the IP address but it's doubtful.

You could try a Dynamic DNS. You create an account and use their client to update your IP Address on their server, then you can query their server for your IP Address.

Google DDNS or Dynamic DNS and you will get a multitude of places offering this service.

A very simple service to use is http://checkip.dyndns.org/. It returns a very basic HTML page that is easy to parse, like (fake IP address):

<html><head><title>Current IP Check</title></head><body>Current IP Address: 127.0.0.1</body></html>

Then you could use the HttpWebRequest and HttpWebResponse classes to get the HTML file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.