如何得到客户端的硬件信息并返回服务器
创建一个activeX,安装到客户端,获取客户端硬件信息,将信息返回给服务器,但是硬件信息具体怎么得到,信息返回用什么方法好呢?哪位高手能帮忙啊,谢谢了...
创建一个activeX,安装到客户端,获取客户端硬件信息,将信息返回给服务器,但是硬件信息具体怎么得到,信息返回用什么方法好呢?哪位高手能帮忙啊,谢谢了
展开
2013-11-11
展开全部
在你的项目中添加引用,
然后你在.net的选项卡里边找.有一个System.Management的项
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();
}
}
然后你在.net的选项卡里边找.有一个System.Management的项
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();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询