问题描述
要求是,用户应该从特定系统登录。为此,我将客户端PC的MAC地址保存到我的数据库中。当用户尝试登录时,Web应用程序应获取客户端PC的MAC ID并验证数据库值。如果匹配,将允许用户登录。是否可以通过WMI对象读取客户端PC的MAC ID?
我尝试过:
var macAddress =;
var ipAddress =;
var computerName = 。;
var wmi = GetObject(winmgmts:{impersonationLevel = impersonate,(Systemtime)}!//+ computerName +/ root / cimv2);
e = new Enumerator(wmi.ExecQuery(SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True));
for(;!e.atEnd(); e.moveNext()){
var s = e.item();
macAddress = s.MACAddress;
ipAddress = s.IPAddress(0);
computerName = s.DNSHostName;
}
Requirement is, the user should log in from specific system. For this I am saving client PC's MAC Address into my database. When user will try to login, the web application should get MAC ID of Client PC and verify with database value. If it matches, user will be allowed to log in. Is it possible to read client PC's MAC id through WMI Object?
What I have tried:
var macAddress = "";
var ipAddress = "";
var computerName = ".";
var wmi = GetObject("winmgmts:{impersonationLevel=impersonate, (Systemtime)}!//" + computerName + "/root/cimv2");
e = new Enumerator(wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"));
for (; !e.atEnd() ; e.moveNext()) {
var s = e.item();
macAddress = s.MACAddress;
ipAddress = s.IPAddress(0);
computerName = s.DNSHostName;
}
推荐答案
这篇关于如何通过ASP.NET应用程序中的java脚本WMI对象读取客户端PC的MAC ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!