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

NT Authentication variables 2

Status
Not open for further replies.

JimFlower

Programmer
Jun 21, 2001
42
GB
I'm using NT Authentication for users to login to my site
How do I fill a variable with the name of the user that is logged in.
 
dim MyVariable
MyVariable = Request.ServerVariables("Logon_User")

That should do the trick.

Hope this helps Tazzmann
 
This didn't work

dim xxx
xxx = Request.ServerVariables("Logon_User")
fp_sQry="SELECT * FROM Results Where User ='" & xxx & "'"

but this does
dim xxx
xxx = "jim"
fp_sQry="SELECT * FROM Results Where User ='" & xxx & "'"

How do I check the value of xxx ?
 
I use these functions for that same purpose:
Code:
Function getUser()
   getUser = StripDomain( Request.ServerVariables("AUTH_USER") )
End Function

Function StripDomain(strLogonUser)
   strLogonUser = Replace(strLogonUser,"/","\")
   StripDomain2 = Right(strLogonUser, (Len(strLogonUser) - InStrRev(strLogonUser, "\", -1, vbTextCompare)))
End Function
Hope this helps,
Palooka
 
On second thought, you still might not get the logon user. Using the function provided in the post above, try this code:
Code:
If Request("LOGON_USER") = "" Then
    Response.Clear
    Response.Status = "401 Unauthorized"
End if

xxx = Stripdomain(Request.ServerVariables("LOGON_USER"))
Hope this helps,
Palooka
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top