public static string GetCustomerMac() { string IP = System.Web.HttpContext.Current.Request.UserHostAddress; string dirResults = ""; ProcessStartInfo psi = new ProcessStartInfo(); Process proc = new Process(); psi.FileName = "nbtstat"; psi.RedirectStandardInput = false; psi.RedirectStandardOutput = true; psi.Arguments = "-A " + IP; psi.UseShellExecute = false; proc = Process.Start(psi); dirResults = proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); dirResults = dirResults.Replace("/r", "").Replace("/n", "").Replace("/t", ""); Regex reg = new Regex("//w{2}-//w{2}-//w{2}-//w{2}-//w{2}-//w{2}", RegexOptions.IgnoreCase | RegexOptions.Compiled); Match mc = reg.Match(dirResults); if (mc.Success) { return mc.Groups[0].Value; } else { reg = new Regex("Host not found", RegexOptions.IgnoreCase | RegexOptions.Compiled); mc = reg.Match(dirResults); if (mc.Success) { return "Host not found!"; } else { return ""; } } } 好像只能取同一个路由以内的地址。。