例如,要使用本地IP地址:
string myHost = System.Net.Dns.GetHostName();
string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[0].ToString();
答案 0 :(得分:3)
这是一个可能有用的链接。 http://www.dreamincode.net/forums/topic/24692-showing-the-external-ip-address-in-c%23/
关于向WhatIsMyIP.com进行网络请求有一个很好的帖子