日期:2014-05-17 浏览次数:20923 次
string GetInternalIpAddress1()
{
try
{
string strUrl = "http://www.3322.org/dyndns/getip"; //获得IP的网址了
Uri uri = new Uri(strUrl);
WebRequest wr = WebRequest.Create(uri);
Stream s = wr.GetResponse().GetResponseStream();
StreamReader sr = new StreamReader(s, Encoding.Default);
string all = sr.ReadToEnd(); //读取网站的数据
all = all.Replace("\r\n", "");
return all;
}
catch (Exception ex)
{
return "";
}
}