Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the Client System Mac-id and other details like IP Address etc
    primarykey
    data
    text
    <p>In web project I have a Page which fetches the Local System Mac-id and other values such as processorid etc,for that I have used the below code.It worked perfectly during Development in the <code>Localhost</code> but when we had published the website and now use the same page to fetch the details,it is fetching the details of the Web Server.Is there any alternate way to fetch the Local Machines details.Kindly any one help.</p> <p>The code I ued for Fetching System details is,</p> <pre><code> #region Sytem Details private string GetMac() { string Mac = string.Empty; ManagementClass MC = new ManagementClass("Win32_NetworkAdapter"); ManagementObjectCollection MOCol = MC.GetInstances(); foreach (ManagementObject MO in MOCol) if (MO != null) { if (MO["MacAddress"] != null) { Mac = MO["MACAddress"].ToString(); if (Mac != string.Empty) break; } } return Mac; } public static string LocalIPAddress() { IPHostEntry host; string localIP = ""; host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily.ToString() == "InterNetwork") { localIP = ip.ToString(); } } return localIP; } private static string GetProcessorName() { ManagementClass mgt = new ManagementClass("Win32_Processor"); ManagementObjectCollection procs = mgt.GetInstances(); foreach (ManagementObject item in procs) return item.Properties["Name"].Value.ToString(); return "Unknown"; } private string GetProcessorID() { string sCpuInfo = String.Empty; bool bSuccess = false; //*** Declare Management Class ManagementClass clsMgtClass = new ManagementClass("Win32_Processor"); ManagementObjectCollection colMgtObjCol = clsMgtClass.GetInstances(); //*** Loop Over Objects foreach (ManagementObject objMgtObj in colMgtObjCol) { //*** Only return cpuInfo from first CPU if (sCpuInfo == String.Empty) { sCpuInfo = objMgtObj.Properties["ProcessorId"].Value.ToString(); bSuccess = true; } } if (bSuccess == true) { } return sCpuInfo; } private static string GetName() { string netBiosName = System.Environment.MachineName; //return netBiosName; // Following method is deprecated // string dnsName = // System.Net.Dns.GetHostByName("LocalHost").HostName; string dnsName = System.Net.Dns.GetHostName(); return dnsName; } private string GetOSName() { System.OperatingSystem os = System.Environment.OSVersion; string osName = "Unknown"; switch (os.Platform) { case System.PlatformID.Win32Windows: switch (os.Version.Minor) { case 0: osName = "Windows 95"; break; case 10: osName = "Windows 98"; break; case 90: osName = "Windows ME"; break; } break; case System.PlatformID.Win32NT: switch (os.Version.Major) { case 3: osName = "Windws NT 3.51"; break; case 4: osName = "Windows NT 4"; break; case 5: if (os.Version.Minor == 0) osName = "Windows 2000"; else if (os.Version.Minor == 1) osName = "Windows XP"; else if (os.Version.Minor == 2) osName = "Windows Server 2003"; else if (os.Version.Minor == 3) osName = "Windows Vista"; else if (os.Version.Minor == 4) osName = "Windows 7"; break; case 6: osName = "Windows 8"; break; } break; } return osName; } #endregion </code></pre> <p><strong>Edit</strong></p> <p>It may not be over the Internet because the User is going to register the System,so he/she only gets the details and registers,so is there any way of Automatically getting the users PC data from his end in Just a Click of a button.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload