日期:2014-05-18 浏览次数:20408 次
private void GetInfo() { string cpuInfo = "";//cpu序列号 ManagementClass cimobject = new ManagementClass("Win32_Processor"); ManagementObjectCollection moc = cimobject.GetInstances(); foreach(ManagementObject mo in moc) { cpuInfo = mo.Properties["ProcessorId"].Value.ToString(); Response.Write ("cpu序列号:"+cpuInfo.ToString ()); } //获取硬盘ID String HDid; ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive"); ManagementObjectCollection moc1 = cimobject1.GetInstances(); foreach(ManagementObject mo in moc1) { HDid = (string)mo.Properties["Model"].Value; Response.Write ("硬盘序列号:"+HDid.ToString ()); } //获取网卡硬件地址 9558821702001755616 ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc2 = mc.GetInstances(); foreach(ManagementObject mo in moc2) { if((bool)mo["IPEnabled"] == true) Response.Write("MAC address\t{0}"+mo["MacAddress"].ToString()); mo.Dispose(); } }
------解决方案--------------------
附带
主机名 = Server.MachineName;
IP地址 = Request.UserHostAddress;
系统时间 = DateTime.Now.ToString();
服务端口 = Request.ServerVariables["SERVER_PORT"];
操作系统 = Environment.OSVersion.ToString().Remove(0, 10);
环境版本 = Request.ServerVariables["SERVER_SOFTWARE"];
------解决方案--------------------
使用mac地址他可以实现 公网IP一样mac地址是不同的
------解决方案--------------------