How can I get the wan IP address for my machine programmatically using C# vs2008.
Asked
Active
Viewed 619 times
2 Answers
1
I found the solution (the function gets my external IP address)
This is the function:
public string getdata()
{
UTF8Encoding utf8 = new UTF8Encoding();
WebClient webClient = new WebClient();
String externalIp = utf8.GetString(webClient.DownloadData("http://whatismyip.com/automation/n09230945.asp"));
return externalIp;
}
1
public string getdata()
{
UTF8Encoding utf8 = new UTF8Encoding();
WebClient webClient = new WebClient();
String externalIp = utf8.GetString(webClient.DownloadData("http://automation.whatismyip.com/n09230945.asp"));
return externalIp;
}

J. Mitchell
- 340
- 4
- 14

KHALID
- 143
- 5
- 16