|
Get PhysicalAddress on Client Pc Using Asp.net 2.0 C#?
I am developing a secured login screen where Client Pc's MAC Address is stored in the database. When the Client Pc Logs-in, the MAC id From The user Is Verified with the MAC ID stored inside the Database. Problem: I cant get the Client Mac Address on the client PC but i get the Servers MAC Id, From where the Apllication is requested. I have Found no solution on this becox asp.net got no feature to grab the client pc's MAC Address. I Tried The Code Below:---- ManagementObjectCollection queryCollection = null;
ManagementScope theScope = null;
theScope = new ManagementScope("\\\\" + Environment.MachineName + "\\root\\cimv2");
try
{
//query = new ManagementObjectSearcher("SELE... * FROM Win32_NetworkAdapterConfigurat...
StringBuilder theQueryBuilder = new StringBuilder();
theQueryBuilder.Append("SELECT * FROM Win32_NetworkAdapter");
//"SELECT * FROM Win32_NetworkAdapterConfigurat...
//"SELECT MACAddress FROM Win32_NetworkAdapter"
ObjectQuery theQuery = new ObjectQuery(theQueryBuilder.To...
ManagementObjectSearcher searcher = new ManagementObjectSearcher(theSc... theQuery);
queryCollection = searcher.Get();
//queryCollection = query.Get();
foreach (ManagementObject mo in queryCollection)
{
if (mo["MacAddress"] != null)
{
MessageBox.Show(mo["MacAddress...
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Source); Console.WriteLine(ex.Message);
But the above code is getting the MAc addresss from where the code is running and the expected client MAC id from the client pc is not possible to get. Inshort The Program Runs from the server and i am accessing the page from the client pc. So it is getting me the server mac address, not the clients mac address...
Please help me out for the same and you can mail me the solution or post it on the forum. |