BalagurunathanS 0 Light Poster

Hi Friends..

I nee to get Mac address of a Remote machine for which i am using VC++ dll method("iphlpapi.dll") to do so..My application is web based.I am using the followin C# code to get the MAC Address..


public class clsMacAdd
{
[DllImport("iphlpapi.dll", ExactSpelling=true)]
public static extern int SendARP( int DestIP, int SrcIP, [Out] byte[] pMacAddr, ref int PhyAddrLen );


public static string GetMacaddress(string strHostName)
{
System.Net.IPHostEntry Tempaddr = null;
string[] Ipaddr = new string[3];

//strHostName = Request.UserHostName;

if ( strHostName == "127.0.0.1" )
{
strHostName = "system102";
}

Tempaddr = (System.Net.IPHostEntry)Dns.GetHostByName( strHostName );

System.Net.IPAddress[] TempAd = Tempaddr.AddressList;

foreach(IPAddress TempA in TempAd)
{
Ipaddr[1] = TempA.ToString();

byte[] ab = new byte[6];
int len = ab.Length;

// This Function Used to Get The Physical Address
//int r = SendARP(int(TempA.Address), 0, ab, ref len );
int r = SendARP( (int) TempA.Address, 0, ab, ref len );
string mac = BitConverter.ToString( ab, 0, 6 );
return mac;
}
return null;
}
}


}


I am getting the MAC address when i run in enterprise network(local),but when i host it a web server(live) i couldn't get the MAC Address..Wat could be the problem..? Someone help in this regard as early as possible..


Regards,


Balaguru