获取客户端的MAC地址。
是否有一种相当简单的方法可以从 ASP.Net Web 应用程序获取客户端的 MAC 地址。
我一直是 4.0,并且使用的是 Visual Studio 2010。
编辑
听着!请不要关闭我的问题! jmccarthy 链接的那个不是同一个。我的请求不是来自网络浏览器。我应该说得更清楚。
Is there a fairly simple way to acquire a client's MAC address from an ASP.Net web application.
I'm 4.0 all the way, and I'm using Visual Studio 2010.
Edits
LISTEN! Please do not close my issue! The one that jmccarthy linked to is not the same. My requests are NOT coming from a web browser. I should have been more clear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的请求不是来自网络浏览器,那么您必须修改客户端以发送其 MAC 地址。如果您无法控制客户端,您就无法从中获取 MAC。
If your requests aren't coming from a web browser, then you have to modify the client to send its MAC address. If you don't have control of the client, you're simply not getting the MAC from it.
我认为除了使用某种插件(ActiveX)之外,没有任何跨浏览器的方法可以做到这一点。
I don't think there is any cross-browser method of doing this short of using some sort of plugin (ActiveX).
这通常是不可能的,也没有意义,因为帧在到达服务器之前可能已经通过了许多路由器和网络设备。
如果您仍然想从服务器执行此操作,而不向客户端添加任何内容,这里有一些带有 C# 代码的链接,用于根据 IP 地址确定 MAC 地址(然后您可以使用 ASP.NET 请求变量):
获取 Mac 地址
获取主机的 MAC 地址
请注意,如果执行此操作,可能会导致严重的性能问题在标准 ASP.NET 请求线程上。您可能想以某种异步方式执行此操作。
It's not in general possible nor meaningful, since the frames have probably passed though many routers and network equipments before getting to your server.
If you still want to do it from the server, without adding anything to your clients, here are some links with C# code to determine the MAC address from an IP Adress (you could then use ASP.NET Request variable):
Get Mac Address
get MAC Address of host
Be aware that this could cause heavy performance problem if you do this on standard ASP.NET request thread. You might want to do it in someasynchronous fashion.