Click here to Skip to main content
15,884,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i get windows user id that is logged in on the client machine in asp.net c#.

I want just the userid that is logged on that other machine and accessing our web application which is hosted in the intranet
Posted

if you use Integrated windows authentication, use will use
C#
Request.ServerVariables["AUTH_USER"]
to grab the user name. if your IIS is set to Anonymous Access the all the request will be placed as ISUER_MachineName user.

if you have any planning to use ActiveX to access wscript.shell and grab local user, try this link.
How to Enable ActiveX in Chrome?
 
Share this answer
 
v2
By saying ASP.NET i assume you meant you like to get the user id of logged in person on client machine accessing your intranet web application.

Try this using JavaScript

JavaScript
var wshshell=new ActiveXObject("wscript.shell");
var username=wshshell.ExpandEnvironmentStrings("%usern ame%");

or this
JavaScript
var ActX=new ActiveXObject("wscript.network");
alert(ActX.username);
 
Share this answer
 
Comments
philiplobo 27-Aug-14 6:34am    
it shows that ActiveXObject is not defined in Chrome Browser. It works in IE but then i have to change some settings which probably would be impossible to do in a organisation as they have their own policies set up.
If you use Windows Authentication, you will know which user logged in.
Of course, that will restrict your web application to only those users that are part pf your domain.

Try How To: Use Windows Authentication in ASP.NET 2.0[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900