protected void Page_Load(object sender, EventArgs e)
{
Response.Write(GetMACAddress());
}
public string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics)
{
if (sMacAddress == String.Empty) // only return MAC Address from first card
{
IPInterfaceProperties properties = adapter.GetIPProperties();
return adapter.GetPhysicalAddress().ToString();
}
}
return String.Empty;
}
{
Response.Write(GetMACAddress());
}
public string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics)
{
if (sMacAddress == String.Empty) // only return MAC Address from first card
{
IPInterfaceProperties properties = adapter.GetIPProperties();
return adapter.GetPhysicalAddress().ToString();
}
}
return String.Empty;
}
Comments
Post a Comment