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

"LOGON_USER" empty string...?

Status
Not open for further replies.

Ram0135

Technical User
Apr 14, 2003
77
US
Hello,
I wanted to know if it were possible to retrieve the usernames of a person logged into a Windows NT/2000/XP machine to authenticate a form. I looked online and I found
Code:
request.servervariables("LOGON_USER")
however it returned an empty string. I also read through MS that you have to turn on basic authentication in IIS for this to work. However how do I configure it for a specific directory or do I just add a header when I want it authenticated. Because this site is for everyone and is not password protected (minus 2 pages) and I dont want any prompts for passwords and such. I do however want to retrieve this information. Is there a way to do it passively w/ out user intervention and / or anon access as well?

Thanks,
Ram0135
 
There is a way to grab the info using vbscript.

Set WSHNetwork = CreateObject("WScript.Network")
UserString = WSHNetwork.UserName


I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
That will only get the username that IIS is running under as it runs on the server.

Without authenticated logon you cannot get the client-side username from the server using ASP.

if the Windows Scripting Host is enabled you might be able to use that (IE only)
something like
Code:
<script language="vbScript">
Set WSHNetwork = WScript.CreateObject("WScript.Network")
WScript.echo "Username = " & WSHNetwork.UserName
 </script>

but for more info on this the VBScript forum329 is where you need to be.

Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top