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

Client data from asp

Status
Not open for further replies.

enak

Programmer
Jul 2, 2002
412
US
I need to get the user name of the person that is logged into a network from a client machine. This is for an intranet. I have the following code:

Dim objNet
Set objNet = CreateObject("WScript.NetWork")
session("UserName")=objNet.UserName

However, this gives me the name that is logged into the web server i.e. IUSR_SERVERNAME

How can I get the user name of the person logged into the network or even the client machine?

TIA
Nate
 
Why would I want to post there? The main issue is VBScript code not ASP.
 
Actually, this is an ASP issue, ie, your question is how to determine the user's username in an ASP page.

FYI. The reason you get IUSR_SERVERNAME is because you are running server side code, and that is the security context that your website's ASP pages are configured to run as when accessed anonymously. If you post in the ASP forum, you'll get suggestions to change the authentication method of your site, either to NTLM or Basic over HTTPS.

You can change that script to run client-side and you'll get the username; however, 1) the Session object is only available server side 2) IE is about the only browser that supports VBS 3) you now have to deal with the browser security issue in order to use the Createobject function.

Either way, this question will be better served in the ASP forum.

Jon Hawkins
 
you prolly will get more help in the asp forum but...here's a thought.

the way that we get user name is to capture the server variable for the user's NT logon and then have a db table where we match the logon with the user data. don't know if you're using NT or not or how to set the server to allow that type of retrieval (our IS guys handle that part.).
hth
mb

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top