0

I am using C#.net ,asp.net and .net framework 2. How to get the serial number of the hard disk of the client system using javascript or asp.net ?

Thanks in advance

  • 1
    You cannot. You'll need client-side code with more access to the machine (A .NET application might be a good choice, based on your ASP.NET experience. Silverlight might also work; not sure). – Michael Petrotta Nov 05 '11 at 22:18
  • 5
    You can't. This would be a security flaw if it would be possible. If you want to do it ouside your browser with a full application, please [read this one](http://stackoverflow.com/questions/4582680/safest-way-to-get-processor-id-or-some-hardware-info/4582698#4582698). – Uwe Keim Nov 05 '11 at 22:19
  • and clickonce can be a good option for simple setup on the client side – Steve B Nov 05 '11 at 22:19
  • are u sure ? what is ur judgment about this http://www.w3schools.com/asp/asp_ref_drive.asp ? Thanks – Jessica Watson Nov 05 '11 at 22:20
  • 2
    Jessica, that returns information about the *server-side* drive. Not the client. – Michael Petrotta Nov 05 '11 at 22:20
  • @JessicaWatson This is VBScript, not JavaScript. In addition, it can be run ON THE SERVER-SIDE, at least what the examples in your link indicate. – Uwe Keim Nov 05 '11 at 22:21
  • is this possible to get the serial with WMI ? – Jessica Watson Nov 05 '11 at 22:30
  • Yes, if you're running code **on the client side with appropriate access**. Not JavaScript, and not ASP.NET. – Michael Petrotta Nov 05 '11 at 22:31

1 Answers1

1

Get Client machine information by Asif Ali

var strComputer = ".";
var SWBemlocator = new ActiveXObject("WbemScripting.SWbemLocator");
var objWMIService = SWBemlocator.ConnectServer(strComputer, "/root/CIMV2");
var strProcess;
var colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem");

var e = new Enumerator(colItems);
for(; ! e.atEnd(); e.moveNext())
{
  strProcess += "itema "+ e.item().Name + "<br>\n";
}

colItems = 
      objWMIService.ExecQuery("Select * from    Win32_NetworkAdapterConfiguration
      where IPEnabled=true");
e = new Enumerator(colItems);
for(; ! e.atEnd(); e.moveNext())
{
  strProcess += "itemb "+ e.item().Name + "<br>\n";
}

document.getElementById('sys_info').innerHTML = strProcess;
j0k
  • 22,600
  • 28
  • 79
  • 90
Asif
  • 11
  • 1