Get the User Device Name and Device Serial Number

john john 946 Reputation points
2022-10-04T18:47:35.747+00:00

Can i build a .net web application which gets the user's Device Name and Device Serial Number ? If this can not be achieved then can i build a .net console app?

Thanks

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,209 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,289 questions
0 comments No comments
{count} votes

Accepted answer
  1. AgaveJoe 26,146 Reputation points
    2022-10-04T21:12:14.083+00:00

    Can i build a .net web application which gets the user's Device Name and Device Serial Number ?

    Browsers operate in a sandbox and cannot read this type of information.

    If this can not be achieved then can i build a .net console app?

    There's already command line tools for fetching a device serial number and name. In Windows...

    wmic bios get serialnumber  
    

    You need to read the docs or do a Google search for the device(s) you are using. Example for Windows.

    Process cmd = new Process();  
      
    cmd.StartInfo.FileName = "cmd.exe";  
    cmd.StartInfo.RedirectStandardInput = true;  
    cmd.StartInfo.RedirectStandardOutput = true;  
    cmd.StartInfo.CreateNoWindow = true;  
    cmd.StartInfo.UseShellExecute = false;  
      
    cmd.Start();  
      
    /* execute "dir" */  
      
    cmd.StandardInput.WriteLine("wmic bios get serialnumber");  
    cmd.StandardInput.WriteLine("echo %computername%");  
    cmd.StandardInput.Flush();  
    cmd.StandardInput.Close();  
    Console.WriteLine(cmd.StandardOutput.ReadToEnd());  
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful