Sergey
Sergey

Reputation: 963

How to know external ip adress of the current pc

For example to get local ip address I use:

 string myHost = System.Net.Dns.GetHostName();
 string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[0].ToString();

Upvotes: 4

Views: 605

Answers (1)

derek
derek

Reputation: 4886

here's a link that may help. http://www.dreamincode.net/forums/topic/24692-showing-the-external-ip-address-in-c%23/

There's a good post on doing a webrequest to WhatIsMyIP.com

Upvotes: 3

Related Questions