关于获取mac地址的问题!急! 我在公司用C#开发了一个小型的web系统,用户登陆时需要获取本地MAC地址保存到数据库。现在出现的问题是,现在可以获取到。但当我到隔壁会议室或者用无线网络登陆系统时,就获取不到MAC地址。请问这是为什么?有什么解决方法么?请各位大侠帮忙啊!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Text.RegularExpressions;using System.Diagnostics;public class test{ public test {} public static string GetCustomerMac(string IP) //para IP is the client's IP { 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("Mac[ ]{0,}Address[ ]{0,}=[ ]{0,}(?<key>((.)*?)) __MAC",RegexOptions.IgnoreCase|RegexOptions.Compiled); Match mc=reg.Match(dirResults+"__MAC"); if(mc.Success) { return mc.Groups["key"].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 ""; } } }}看看这个可不可以啊 IP数据包里面可以不包含MAC地址的。是通过IP寻找数据传送路径的。每个路由知道接入自己的终端的MAC和IP的对应关系就可以了,路由会定位。我不太记得清楚了,毕业后没用过了。好像以前在学校没钱交网费,遍历整个局域网,别人拿MAC地址和IP偷网上的时候,只能拿到本局域网的,因为路由知道接入他的终端的MAC,但是ping局域网外的就拿不到MAC。 asp.net(vb)刷新页面会自动执行按钮click事件 XML文档读到DataTable里面怎么成了这样? GridView如何按一周7天来分页与排序? 小白求教:关于一个数值转换错误的问题。 DataGrid 能放50000条以上记录吗? 自定义控件有含有button,自动生成的页面就没有__dopostback函数,为什么? 有谁一起做网站吗? 继承页面的Session问题(999在线等) 关于服务器性能监控! Asp.net退出框架問題 未被识别为有效的布尔值,很着急~~在线等,怎么都调不出来 返回为负数
using System.Diagnostics;
public class test
{
public test
{}
public static string GetCustomerMac(string IP) //para IP is the client's IP
{
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("Mac[ ]{0,}Address[ ]{0,}=[ ]{0,}(?<key>((.)*?)) __MAC",RegexOptions.IgnoreCase|RegexOptions.Compiled);
Match mc=reg.Match(dirResults+"__MAC"); if(mc.Success)
{
return mc.Groups["key"].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 "";
}
}
}
}
看看这个可不可以啊