I tried this:
Response.Write Request.ServerVariables("AUTH_USER")
and it is empty. 

Do you have to have active directory running on your web server? 

I did try disabling "anonymous access" and checked "Integrated Windows 
Authentication", but then it asked me for a user name and password. I 
tried using my network logon and it failed. 

If it makes a difference, our web servers are not the domain servers that 
people log into. They are joined to the domain, but not the server that 
people log into. 

Soren






Mark E <[EMAIL PROTECTED]>
09/02/2004 04:37 AM
Please respond to active-server-pages
 
        To:     [EMAIL PROTECTED]
        cc: 
        Subject:        Re: [ASP] Windows Logon Credentials


Here is the code that I use to grab the network ID from someone on my 
network:
 
Function GetNetworkID
'This function returns the visitors network ID.
 Dim strUserName, intCounter
 Dim intLengthOfName, strAuthUser
 
 'Set initial value to 0.
 intLengthOfName = 0
 
 'Get the ttl len of the user name.
 intLengthOfName = len(Request.ServerVariables("AUTH_USER"))
 
 'Get the username and validate it.
 strAuthUser = Request.ServerVariables("AUTH_USER")
 
 'Make sure we have a length before we continue.
 if intLengthOfName > 0 then
  'We do, get the users ID.
  'Find the slash ("/")
  for intCounter = 1 to intLengthOfName
   'Loop through & grab each letter from the AUTH_USER value.
   strLetter = mid(strAuthUser, intCounter, 1)
   'Check for the slash
   if strLetter = "\" then
    'We found the slash, parse out the actual userID & exit the for loop.
    strUserName = mid(strAuthUser, intCounter+1,intLengthOfName)
    exit for
   end if
  next
 end if
 
 'Pass back the userID
  GetNetworkID = strUserName
end function  'GetNetworkID
 
Mark

[EMAIL PROTECTED] wrote:
I would love to get a look at that code!

Soren





Mark E <[EMAIL PROTECTED]>
09/01/2004 04:05 PM
Please respond to active-server-pages

        To:     [EMAIL PROTECTED]
        cc: 
        Subject:        Re: [ASP] Windows Logon Credentials


How I accomplish this at work:

1) Open IIS
2) Right-click your virtual directory
3) Select Properties
4) Go to the Directory Security tab
5) Click the Edit button under "Anonymous access and authentication 
control"
6) Uncheck "Anonymouds access"

This means that the visitor will not browse using the IUSR_<server_name> 
account.

Then use Request.ServerVariables("AUTH_USER") to return the domain login.

I have the code at work and I can't recall the entire function that I use 
since it strips off the "Domain\" of the "Domain\UserName" value.  Let me 
know if you want it and I will shot it over to you tomorrow.

HTH,
Mark

wilgf <[EMAIL PROTECTED]> wrote:
Hi.  I just wanted to know if there is a way to use ASP to determine 
the windows logon name of the currently logged in user on an 
anonymous client visiting an asp server?

That sounds confusing even to me.  Let me try again.

A fellow logs onto windows 2000 using his domain account.  He opens 
up a web browser and surfs to my asp enabled web page.

Is there any way I can write an asp page to GRAB that windows logon?

ASP Server Variables only get the ip address of the local machine.  I 
wanted to know who was LOGGED IN.

is there a way to get that info?  Myabe even via javascript and 
submitting it to the server with hidden form variables?

Has anyone done this?

Thanks :)



--------------------------------------------------------------------- 
Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post       : [EMAIL PROTECTED]
Subscribe  : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 


Yahoo! Groups Sponsordocument.write('');

---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/

   To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]




--------------------------------------------------------------------- 
Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post       : [EMAIL PROTECTED]
Subscribe  : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links








[Non-text portions of this message have been removed]



--------------------------------------------------------------------- 
Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post       : [EMAIL PROTECTED]
Subscribe  : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 


Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
 
   To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]




--------------------------------------------------------------------- 
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links



 




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to