Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2845
  • Last Modified:

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.
0
adypips
Asked:
adypips
  • 3
  • 2
1 Solution
 
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
 
adypipsAuthor 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now