This article introduced the ASP.net to obtain the client Nic Mac The small example, the need friend may refer to the
copy code code as follows:
using System.Text.RegularExpressions;
using System.Diagnostics;
public class Test
{
Public Test
{}
public static string Getcustomermac (String IP)//para IP is the clients IP
{
string dirresults= "";
ProcessStartInfo psi = new ProcessStartInfo ();
Process proc = new process ();
Psi. FileName = "nbtstat";
PSI. Redirectstandardinput = false;
PSI. Redirectstandardoutput = true;
PSI. Arguments = "-A" + IP;
PSI. UseShellExecute = false;
proc = Process.Start (PSI);
dirresults = Proc. Standardoutput.readtoend ();
Proc. WaitForExit ();
dirresults=dirresults.replace ("", ""). Replace ("", ""). Replace ("", "");
regex reg=new Regex ("mac[]{0,}address[]{0,}=[]{0,}" (?<key> (.) *?)) __mac ", regexoptions.ignorecase|regexoptions.compiled);
Match Mc=reg. Match (dirresults+ "__mac");
if (MC. Success)
{
return MC. groups["Key"]. Value;
}
Else
{
reg=new Regex ("Host not Found", regexoptions.ignorecase|regexoptions.compiled);
Mc=reg. Match (Dirresults);
if (MC. Success)
{
return "Host not found!";
}
else
{
return "";
}
}
}
}