Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
2,684 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

721 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