Home All Groups Group Topic Archive Search About

How to get the Windows current logged user name using ASP

Author
16 May 2006 5:20 PM
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

Author
16 May 2006 5:33 PM
Bob Barrows [MVP]
mvr wrote:
> 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")
%>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Are all your drivers up to date? click for free checkup

Author
16 May 2006 5:44 PM
Aaron Bertrand [SQL Server MVP]
Silly me, I was thinking the user logged onto the machine, not the user
requesting the web page.



Show quoteHide quote
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:ex7VO7QeGHA.3364@TK2MSFTNGP05.phx.gbl...
> mvr wrote:
>> 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")
> %>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Author
16 May 2006 6:41 PM
Bob Barrows [MVP]
:-)
You're just a little out of practice

Aaron Bertrand [SQL Server MVP] wrote:
Show quoteHide quote
> Silly me, I was thinking the user logged onto the machine, not the
> user requesting the web page.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Author
16 May 2006 6:44 PM
Aaron Bertrand [SQL Server MVP]
I know, what on earth am I doing here, anyway...


Show quoteHide quote
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OvtsShReGHA.2188@TK2MSFTNGP04.phx.gbl...
> :-)
> You're just a little out of practice
Author
16 May 2006 5:35 PM
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.



Show quoteHide quote
"mvr" <v_en***@hotmail.com> wrote in message
news:uOESI0QeGHA.3900@TK2MSFTNGP05.phx.gbl...
> 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
>
>

Bookmark and Share

Post Thread options