如何从C#ASP.Net Web应用程序获取客户端系统MAC地址 [英] How to get client system MAC Address from C# ASP.Net web application
本文介绍了如何从C#ASP.Net Web应用程序获取客户端系统MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从C#ASP.Net Web应用程序获取客户端系统MAC地址
How to get client system MAC Address from C# ASP.Net web application
推荐答案
尝试以下内容:
Try below:
You need to import the System.Net namespace for this to work. This will support IPv4 and IPv6.
public string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach (NetworkInterface adapter in nics)
{
if (sMacAddress == String.Empty)// only return MAC Address from first card
{
IPInterfaceProperties properties = adapter.GetIPProperties();
sMacAddress = adapter.GetPhysicalAddress().ToString();
}
} return sMacAddress;
}
Also check the link if get MAC address in message box using c#[^]
这篇关于如何从C#ASP.Net Web应用程序获取客户端系统MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文