How do I grab a user's NT username ?

Results 1 to 3 of 3

Thread: How do I grab a user's NT username ?

  1. #1
    Charlie Pyne Guest

    Default How do I grab a user's NT username ?

    I posted a message here a while back trying to figure out how to do this. I was told to use request.servervariables("LOGON_USER"), but I can&#039t get it to return anything...<BR><BR>I&#039m logged into out network here under my NT username, but I&#039m doing my work with Personal Web Server running on my own PC.. Is this whats screwing me up??<BR><BR>Heres a test page that doesn&#039t work... It just prints the ????&#039s<BR>(I&#039ve tried a few different variations of this with no luck)<BR><BR>&#060;%<BR>response.expires = 0<BR>Dim var <BR>dim nt_user <BR>set var = Request.ServerVariables<BR>nt_user = var("LOGON_USER")<BR>response.write nt_user<BR>response.write "????"<BR>%&#062;

  2. #2
    KPW Guest

    Default RE: How do I grab a user's NT username ?

    In IIS, you must set the properties of the folder to disallow anonymous user logon.

  3. #3
    Grant LeTourneau Guest

    Default RE: How do I grab a user's NT username ?

    Actually I believe it&#039s Request.ServerVariables("AUTH_USER") - at least that&#039s the one I&#039m using for Challenge/Response authentication. <BR><BR>I&#039ll take this question one step further. I need to have my asp pages run as the anonymous account because users don&#039t have permission to do what these pages do. BUT, I also need the user to be authenticated and I need to retrieve their user name. I&#039ve come up with a solution but I&#039d like some comments.<BR><BR>1. Set the main application directory to ONLY allow Anonymous access (which has the correct permissions to run the scripts.)<BR><BR>2. Create a subdirectory called "login" under the root of the application which ONLY allows Challenge/Response.<BR><BR>3. Stick this at the top of the .asp pages:<BR> IF Request.Cookies("groupadmin")("username") = "" THEN Response.Redirect "login/login.asp"<BR><BR>4. Create login.asp (in the "login" Challenge/Response directory) containing this:<BR> &#060;% <BR> Response.Cookies("groupadmin")("username") = Request.ServerVariables("AUTH_USER")<BR> Response.Redirect "../default.asp"<BR> %&#062;<BR><BR>It seems to be working OK, but I don&#039t know how easy it might be to spoof a cookie...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts