问题描述
大家好,
i试图获取客户端机器的mac地址,但是当我在服务器上传时,我得到服务器mac地址而不是客户端mac地址。
plz any这个问题的解决方案。
i想要客户端mac地址。
谢谢
我尝试过:
公共字符串GetMACAddress()
{
NetworkInterface [] nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach(nics中的NetworkInterface适配器)
{
if(sMacAddress == String.Empty)//仅从第一张卡返回MAC地址
{
IPInterfaceProperties properties = adapter.GetIPProperties ();
sMacAddress = adapter.GetPhysicalAddress()。ToString();
}
}
返回sMacAddress;
}
Hello all,
i trying to get mac address of client machine but when i upload on server i am getting server mac address instead of client mac address.
plz any solution for this problem.
i want client mac address.
thanks
What I have tried:
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;
}
推荐答案
这篇关于获取服务器mac地址,但我想要客户端mac地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!