javascriptasp.netcomputer-name

How can I read the client's machine/computer name from the browser?


How can I read the client's machine/computer name from the browser?
Is it possible using JavaScript and/or ASP.NET?


Solution

  • You can do it with IE 'sometimes' as I have done this for an internal application on an intranet which is IE only. Try the following:

    function GetComputerName() {
        try {
            var network = new ActiveXObject('WScript.Network');
            // Show a pop up if it works
            alert(network.computerName);
        }
        catch (e) { }
    }
    

    It may or may not require some specific security setting setup in IE as well to allow the browser to access the ActiveX object.

    Here is a link to some more info on WScript: More Information