using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.NetworkInformation;
public partial class _Default : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String
sMacAddress = string.Empty;
foreach
(NetworkInterface adapter in nics)
{
if
(sMacAddress == String.Empty)// only return MAC Address from first card
{
sMacAddress = adapter.GetPhysicalAddress().ToString();
}
}
TextBox1.Text
= sMacAddress;
}
}
No comments:
Post a Comment