Get the current windows logged on user using Java Script

By Perry

I have shown here what all the things I have tried to get the current windows logged on user using Java Script.

I have tried below things to Get the current windows logged on user using Java Script. If you are also trying to Get the current windows logged on user using Java Script then please do not waste your time. You can simply tell your boss that it is not possible to Get the current windows logged on user using Java Script because of security reasons.

1.
var WinNetwork = new  ActiveXObject("WScript.Network"); alert(WinNetwork.UserName);
This method works only on IE and you require special privileges for Activex object but no system admin will provide those permissions by default.

2. Request.ServerVariables("LOGON_user")  ==> No use

3. HttpContext.Current.User.Identity.Name ==> doesn't work.

4. Request.ServerVariables["AUTH_USER"] or Request.ServerVariables[5] ==> didn't work

Get the current windows logged on user using Java Script  (1722 Views)