MisterBigglesworth
Expert Member
- Joined
- Aug 15, 2006
- Messages
- 3,330
Hi guys,
Have an interesting dilemma here. Our Intranet runs Windows Authentication for our users in our office. We have another branch that we want to give access to, but they cant get in as it asks for a username and password as they are not on the same domain etc.
So I enabled Anonymous authentication with Windows Authentication, and now they can get. So our users can get in to the Intranet as well as users from the external office & domain.
Problem is I cant use both authentications because some of my ASP code that makes use of Windows Authentication has stopped working (I check who the user is on their pc, and I get their email address & other data as needed off active directory).
So now I cant read our users details from Active Directory because even though both anonymous and windows authentication is running....its somehow broken the ability to read this data.
Any ideas on how to fix this and get both authentications working together? The email and displayname at the bottom of the code used to return values (when it was only windows authentication), now nothing is returned, no error....just empty values?? Here is a sample of the code I use:
Have an interesting dilemma here. Our Intranet runs Windows Authentication for our users in our office. We have another branch that we want to give access to, but they cant get in as it asks for a username and password as they are not on the same domain etc.
So I enabled Anonymous authentication with Windows Authentication, and now they can get. So our users can get in to the Intranet as well as users from the external office & domain.
Problem is I cant use both authentications because some of my ASP code that makes use of Windows Authentication has stopped working (I check who the user is on their pc, and I get their email address & other data as needed off active directory).
So now I cant read our users details from Active Directory because even though both anonymous and windows authentication is running....its somehow broken the ability to read this data.
Any ideas on how to fix this and get both authentications working together? The email and displayname at the bottom of the code used to return values (when it was only windows authentication), now nothing is returned, no error....just empty values?? Here is a sample of the code I use:
Code:
vAuth_User = Request.ServerVariables("AUTH_USER")
vAuth_User = Replace(vAuth_User, "DOMAIN_NAME.CO.ZA\", "")
vAttribute1 = "mail"
vAttribute2 = "displayName"
vAttributes = vAttribute1 & "," & vAttribute2
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
'** RH ** account username and password to log in with to check credentials
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = "DOMAIN_NAME.CO.ZA\Administrator"
objConnection.Properties("Password") = "12345"
objConnection.Open "Active Directory Provider"
'** RH ** search for all user objects
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" & vAuth_User & "))"
strAttributes = vAttributes
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
Set objRecordSet = objConnection.Execute(strQuery)
If objRecordSet.EOF = False Then
vLDAP_EMail = objRecordSet.Fields(vAttribute1)
vLDAP_Display_Name = objRecordSet.Fields(vAttribute2)
End If