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
1,987 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now