How to get hold of the client computername with Javascript and how to integrate this into ASP.NET

Hi I am looking for some javascript code that will pick up the clients computer name? is this possible as I need to find the computername of the person logging a call with our e-form. I not a javascript whizz so would really appreciate some completed code snippets and advise on intergrating this into asp.net. Many thanks Adypips.
adypipsAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
adypipsConnect With a Mentor Author Commented:
I have found a way of achieving this this works really well.

script type="text/javascript">
    
    var WshNetwork = new ActiveXObject("WScript.Network");
    var strComputer = WshNetwork.ComputerName;
   
    
//  document.getElementById("Text1").value = strComputer // This allow you to store in textbox for example
    document.write(strComputer);  // Or you can just write out to webform/webpage.
</script>

Open in new window

0
 
raterusCommented:
Unless you are on an intranet, where you have DNS control of the computers of your clients, you are out of luck.  Javascript security prevents you from obtaining this name.
0
 
adypipsAuthor Commented:
This is all for internal use so, on intranet. Is there away around the security if for internal use? I can get the IP Address. Would I have to pass the IP address to look up the name using DNS?
0
 
raterusCommented:
Yes, you just need to run a reverse DNS lookup using the IP Address.  This of course is dependent on your local DNS server being properly maintained with reverse entries.

You should find plenty of examples if you search for "Reverse DNS .net", but let me know if you can't figure it out.
0
 
adypipsAuthor Commented:
Thanks raterus your help is appriecated. Thanks again Adrian
0
All Courses

From novice to tech pro — start learning today.