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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get windows user id or name using javascript

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
How to get windows user id or login id or username using javascript???

thanks albaiz
 
That sounds like a security issue! Not sure you can. I'm trying, really I am!
admin@onpntwebdesigns.com
 
I think first you would have to ask the user for that info in a form and then you could store it in a cookie.

If you wanted to grab it straight out of the browser without asking the user, it would probably be illegal (at least not ethical) and like onpnt said, most likely not even possible.
 
Actualy this is to be used company intranet, to know the LAN user id instead of asking him to enter it again.

regards
albaiz
 
sounds like you'll need a server side script to search the database or however the usernames are stored. Is this on Win NT? Deffinetly don't think you can do this with javascript client side. When the user signs on then you can save the login as a session variable to use later for whatever you want to do. I'm trying, really I am!
admin@onpntwebdesigns.com
 
Hi everyone.

I have same problem. It's the company intranet and the users don't want enter user ID and password again.

User ID is valid to LAN and SQL Server, then I will want to enter one time the ID.

Thanks.

 
Maybe I am misunderstanding the problem, but couldn't you do this with a cookie? Create a temporary cookie that holds the information and then just refer to that whenever a user makes a request that requires an ID?

jaxon
 

I guess when a user login to a LAN, then the windows userID and the LAN userID will be the same.

So to get windows userID is easer without writing a server side scripting.

FYI,
you can read the LAN userID using the following code if u r using IIS & ASP:
strUserID = Request.ServerVariables("AUTH_USER")

BUT I'M USING APACHE on WIN2000AdvServer.

regards
albaiz


 

I guess when a user login to a LAN, then the windows userID and the LAN userID will be the same.

So to get windows userID is easer without writing a server side scripting.

FYI,
you can read the LAN userID using the following code if u r using IIS & ASP:
strUserID = Request.ServerVariables("AUTH_USER")

BUT I'M USING APACHE on WIN2000AdvServer.

regards
albaiz


 
albaiz,

javascript does not have access to this type of information for security reasons. imagine if you went to a site that could grab your windows user id through javascript...then using document.referrer they'd know where you came from, and all they'd need to guess now is your password.

======================================

if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top