[thelist] please tell me

James Hardy evolt at weeb.biz
Tue Aug 23 10:27:55 CDT 2005

Deborah Cadranel wrote:
> how to retrieve the windows user name via js

Three answers for three different scenarios:

1) if you are using server side js in ASP and you are using NT 
authentication for your IIS web server then:

var username = request.serverVariables("AUTH_USER")

2) client side in a browser, you should never get it for security 
reasons (unless you use some kind of IE activex control to take it, but 
that is way beyond me)

3) js using windows scripting host:

var WSHNetwork = new ActiveXObject('WScript.Network');
var strUserName = WSHNetwork.UserName;

James Hardy

More information about the thelist mailing list