{
tring mac = "";
System.Diagnostics.Process process =
new System.Diagnostics.Process();
rocess.StartInfo.FileName = "nbtstat";
rocess.StartInfo.Arguments = "-a "+clientIP;
rocess.StartInfo.UseShellExecute = false;
rocess.StartInfo.CreateNoWindow = true;
rocess.StartInfo.RedirectStandardOutput = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
int length = output.IndexOf("MAC Address = ");
if(length>0)
{
mac = output.Substring(length+14, 17);
}
process.WaitForExit();
return mac.Replace("-", "").Trim();
}
}}
4.写javascript,新建一个名为default.js文件如下
function GetMac()
{
var clientIP="192.168.0.1";
//document.getElementById("Mac").value
=DemoMethods.GetCustomerMac(clientIP).value
alert(DemoMethods.GetCustomerMac
(clientIP).value);
}
5.在某个Aspx页面放上一个html 的button在页面上中引用default.js :
lt;
script language="javascript"
src="default.js">
</script>
在INPUT的onclick事件中加上
onclick="javascript:GetMac()"
lt;
INPUT style="Z-INDEX: 101;
LEFT: 392px; POSITION: absolute;
TOP: 176px" type="button"
value="客户端获取IP" onclick="javascript:GetMac();">
|
||
相关热词搜索: |
||
收藏到网摘: | ||
|