How to get unique Processor ID or hardware ID in asp.net c#

As we know that many times, we want to login on particular device or we need to hardware id of any system because we know that every system has contain a unique hardware id. So here discuss about how to get unique hardware ID in asp.net c#, you can also read about

First we need to add below namespace

using System.Management;


If you are facing any problem to add namespace then you must add reference with System.Management name.

Source Code:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Management;


public partial class hardwareid : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       if(!IsPostBack)
        {
            getid();
        }

    }


    protected void getid()
    {
       
        ManagementObjectCollection mbcList = null;
        ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select * From Win32_processor");
        mbcList = mbs.Get();
        string processorid = "";
        foreach (ManagementObject mo in mbcList)
        {
            processorid = mo["ProcessorID"].ToString();

        }

       

        string ipvalue = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        if (string.IsNullOrEmpty(ipvalue))

        {
            ipvalue = Request.ServerVariables["REMOTE_ADDR"];
        }

        ipvalue = ipvalue.ToString();

    }

   
}






How to get unique Processor ID or hardware ID in asp.net c# How to get unique Processor ID or hardware ID in asp.net c# Reviewed by NEERAJ SRIVASTAVA on 7:11:00 PM Rating: 5

No comments:

Powered by Blogger.