How to get the Windows current logged user name using ASP

M

mvr

Hi all

How to get the Windows current logged user name using Classic ASP.
If no direct way are there any work arounds.

Thanks
mvr
 
B

Bob Barrows [MVP]

mvr said:
Hi all

How to get the Windows current logged user name using Classic
ASP. If no direct way are there any work arounds.
1. Turn off Anonymous access to your site using IIS Manager
2. Use the LOGON_USER servervariable:
<%
response.write request.servervariables("LOGON_USER")
%>
 
A

Aaron Bertrand [SQL Server MVP]

If you have one person logged onto the console directly, and two people
logged in through terminal services, what do you want to see? You can
probably hook into ADSI or use WScript.Network, but I think it will require
significantly elevated privileges (typically not recommended for a classic
ASP application).

One possible workaround is to use a data store for this, and have a login
script in the startup folder that stores %USERNAME% in a table. It will be
tougher to detect logoffs and inactive/expired sessions, of course.
 
A

Aaron Bertrand [SQL Server MVP]

Silly me, I was thinking the user logged onto the machine, not the user
requesting the web page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top