Solved

Access network credentials using javascript

Posted on 2012-04-12
13
793 Views
Last Modified: 2013-11-21
Is there anyway to access network credentials with javascript without having to manually set them? This is needed in order to pass the credentials dynamically to a webservice. The webservice is setup for windows authentication and the browser is IE8.
0
Comment
Question by:EntAppDevTeam
  • 5
  • 4
13 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37841064
Try the code mentioned here.
http://www.ureader.com/msg/16721933.aspx
<script language=javascript>   
  function getNTUsername(){
  
var wshNetwork = new ActiveXObject("WScript.Network");   
        alert('domain ='+   wshNetwork.UserDomain);   
        alert('machine name = '+   wshNetwork.ComputerName);   
        alert('user name = '+   wshNetwork.UserName);
        document.getElementById('username').value = wshNetwork.UserName;
        document.getElementById('UsernameDiv').innerHTML = 
wshNetwork.UserName;
  }
</script>   

Open in new window


However your HTML has to be saved with extension .hta and has to be loaded from hard disk
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37841301
mplungjan, just for curiosity: how would a local stored .hta file be loaded/used by a page send from anywhere without violating the SOP?
(sorry for the silly question, as I'm no IE and M$ guru ;-)
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37841313
You will need to "save/open" it from the web or copy it to your intranet users if that is what you need.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 250 total points
ID: 37841321
hmm, let's see if the author ask for an intranet solution which requires IE policies set to ignore any security ...
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 250 total points
ID: 37841326
If not, then the answer is: not possible
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:EntAppDevTeam
ID: 37843327
This won't work.  At best, the user will be prompted to allow on every page load. Check it out http://forums.asp.net/t/1124769.aspx
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37843387
question answered, isn't it?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37843846
hmm, mplungjan helped answering too, IMHO ...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37844158
I believe I did.

What you are trying to do is a security risk, hence it only works on the lowest security level - that is when the user started the HTA him/herself

this cannot be done from a web page from a web server
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 37844508
@all: I fully agree with mplungjan's comments and helped to point out the limits
sorry for beining a bit short in my comments, but mplungjan got them all:)
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

Suggested Solutions

Title # Comments Views Activity
Debugging step-by-step Jquery/Javascript 6 55
jQuery Parallax 1 38
Facebook React and SyntheticEvents 6 45
how can i get a 4  at the second console.log? 6 23
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

947 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

23 Experts available now in Live!

Get 1:1 Help Now