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,875 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

706 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

17 Experts available now in Live!

Get 1:1 Help Now