Imagine a situation, I have PC with two lan cards, one is connected to internet another is connected to local network, how can I detect IP which is connected to internet wi
I suggest this simple code since tracert is not always effective and whatsmyip.com is not specially designed for that purpose :
private void GetIP()
{
WebClient wc = new WebClient();
string strIP = wc.DownloadString("http://checkip.dyndns.org");
strIP = (new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")).Match(strIP).Value;
wc.Dispose();
return strIP;
}