读书人

IPHostEntry strIp = Dns.Resolve(Env

发布时间: 2011-12-20 22:26:41 作者: rapoo

IPHostEntry strIp = Dns.Resolve(Environment.MachineName);报错!!!
Page_load代码中写入如下代码:
String hostIp;
hostIp = " ";
IPHostEntry strIp = Dns.Resolve(Environment.MachineName);
//上面一句报错了。有一个警告。
for (int i = 0; i < strIp.AddressList.Length; i++)
hostIp += String.Format( "NetCard[{0}],IP={1}\n ", i + 1, strIp.AddressList[i].ToString());
Response.Write(hostIp);

错误内容如下:
警告1“System.Net.Dns.Resolve(string)”已过时:“Resolve is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202”D:\BMSystem\BMMain\IpConfig.aspx.cs2538http://localhost/BMSystem/


[解决办法]
警告而已 不理它

读书人网 >asp.net

热点推荐