Solved

Access network credentials using javascript

Posted on 2012-04-12
13
797 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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
 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
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)

785 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