Professionallearn.com

[ Log On ]
< <
 

Details

Posted By: P.R.S
11/4/2012 12:00:00 AM
language: Asp.net MVC

1.Put this in .aspx

<%@ Import Namespace=" System.Net.NetworkInformation"%> above

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2. Put in Body tag

<body>

<%
    var macAddress="";
  NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
  foreach (NetworkInterface adapter in nics)
  {
      IPInterfaceProperties properties = adapter.GetIPProperties();
      string _temp = adapter.GetPhysicalAddress().ToString();
      if (!string.IsNullOrEmpty(_temp))
      {
          macAddress = _temp;
      }
  }
     %>

</body>

and you print or call macAddress where you want .

Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Sponsor