Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WScript.Network not working

Status
Not open for further replies.

enak

Programmer
Jul 2, 2002
412
US
I have created a web application. In it I need to get the username from the client machine. I use the following code to do this:

var sUser
function getUserName() {
var oNet, cInitial, startTime, sSQL;
oNet = new ActiveXObject("WScript.Network");
// Get the user name.
sUser = oNet.UserName;

frmMain.UserID.value=sUser;
}

function go(){
getUserName();
frmMain.submit();
}

The "go" function is called when the user clicks on a login button. Everything works fine when I use it on my local machine. However, when I move it to the server I get an error message that states that "Automation server can't create object".

What can I do to get this to work? WScript.exe does exist on the server.

TIA
Nate
 
Never mind. it was a security issue.
 
So how did you get it to work (or get around it)?

--Ryan
 
I changed the security settings on the browser. I don't like having to fix it this way because the users may not have the same settings on their browsers and can get frustrated if it does not work for them.
 
Cool... On a related note, you don't know if WScript.Shell works in Javascript, do you? Or if there's any other way to run an external program in Javascript (with low security settings, of course)?

--Ryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top