【发布时间】:2012-05-03 21:09:12
【问题描述】:
我有以下问题: 我有一个网络服务器。该网络服务器位于路由器后面。问题是,我需要在服务器上打开网站以用于进一步目的的客户端的 MAC 地址。我已经尝试通过 ActiveX-Object 获取 MAC 地址,但客户端需要安装 WMI。以下是实际代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script id="clientEventHandlersJS" language="javascript">
function Button1_onclick() {
var locator = new ActiveXObject("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
var e = new Enumerator (properties);
document.write("<table border=1>");
dispHeading();
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
document.write("<tr>");
document.write("<td>" + p.Caption + "</td>");
document.write("<td>" + p.IPFilterSecurityEnabled + "</td>");
document.write("<td>" + p.IPPortSecurityEnabled + "</td>");
document.write("<td>" + p.IPXAddress + "</td>");
document.write("<td>" + p.IPXEnabled + "</td>");
document.write("<td>" + p.IPXNetworkNumber + "</td>");
document.write("<td>" + p.MACAddress + "</td>");
document.write("<td>" + p.WINSPrimaryServer + "</td>");
document.write("<td>" + p.WINSSecondaryServer + "</td>");
document.write("</tr>");
}
document.write("</table>");
}
function dispHeading()
{
document.write("<thead>");
document.write("<td>Caption</td>");
document.write("<td>IPFilterSecurityEnabled</td>");
document.write("<td>IPPortSecurityEnabled</td>");
document.write("<td>IPXAddress</td>");
document.write("<td>IPXEnabled</td>");
document.write("<td>IPXNetworkNumber</td>");
document.write("<td>MACAddress</td>");
document.write("<td>WINSPrimaryServer</td>");
document.write("<td>WINSSecondaryServer</td>");
document.write("</thead>");
}
</script>
</head>
<body>
<INPUT id="Button1" type="button" value="Button" name="Button1" language="javascript" onclick="return Button1_onclick()">
</body>
当您单击该按钮时,它应该返回一个包含网络配置的表格,但这对我不起作用。我想知道,是否有另一种解决方案可以通过浏览器获取客户端的 MAC 地址。我也不想限制在 Internet Explorer 上的使用。提前感谢您的帮助。
问候, 克里斯
【问题讨论】:
-
为什么需要知道MAC地址?
-
因为我想通过 SNMP 向托管交换机发送请求以获取客户端的连接端口。我的公司正在制作一个设施管理软件,通过 MAC 地址,我们可以找到客户在哪个房间。在我们找出客户在哪个房间后,我们会显示一个网站来控制实际房间。您可以通过“房间管理网站”向室内百叶窗发送命令、设置室温或打开窗户。
-
您找到解决方案了吗?我正在尝试做同样的事情
-
您找到解决方案了吗?我正在尝试做同样的事情。
-
不,实际上我们根本找不到MAC地址。
标签: browser client mac-address