Solved

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

Posted on 2009-07-15
5
2,155 Views
Last Modified: 2012-05-07
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.
0
Comment
Question by:adypips
  • 3
  • 2
5 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 24862782
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
 

Author Comment

by:adypips
ID: 24864439
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
 
LVL 33

Expert Comment

by:raterus
ID: 24869261
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
 

Author Comment

by:adypips
ID: 24872716
Thanks raterus your help is appriecated. Thanks again Adrian
0
 

Accepted Solution

by:
adypips earned 0 total points
ID: 24889417
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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question