2楼仁兄,这是服务器上的程序,从服务器执行nbtstat获取客户端MAC

解决方案 »

  1.   

    你先找找重装系统后系统目录还还有没有nbtstat.exe这个程序吧,有些安装包没带,就不能用了。
      

  2.   

    这个肯定有的,CMD下直接使用可以,但是用web程序调用就不行了
      

  3.   

    这个肯定有的,CMD下直接使用可以,但是用web程序调用就不行了 
      

  4.   

    你web进程用的什么用户有执行权限吗
      

  5.   


    Web呀,那肯定是没有权限了,把Web权限提到管理员组去。
      

  6.   

    //获取本机真实MAC地址代码如下:using System;
    using System.Runtime.InteropServices;public partial class _Default : System.Web.UI.Page
    {
        [DllImport("Iphlpapi.dll")]
        private static extern int SendARP(Int32 dest, Int32 host, ref Int32 mac, ref Int32 length);
        [DllImport("Ws2_32.dll")]
        private static extern Int32 inet_addr(string ip);    protected void Page_Load(object sender, EventArgs e)
        {
            string IPAddress = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString();
            string mac = "";
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName = "nbtstat";
            p.StartInfo.Arguments = "-a   " + IPAddress;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.Start();
            string output = p.StandardOutput.ReadToEnd();
            int len = output.IndexOf("MAC 地址 = ");
            if (len > 0)
            {
                mac = output.Substring(len + 8, 18);
            }
            this.txtmac.Text = mac;
        }
    }