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.cs 25 38 http://localhost/BMSystem/
------解决方案--------------------------------------------------------
警告而已 不理它