Argghhhhhh. This is annoying me now. I've coded up a nice ASP solution based on some of the excellent work previously seen on this site, in particular that of zcolton. It retrieves details about a user from AD based on the Auth_User. It's for logging support requests for the IT department, and it emails all the details to us so we have them to hand.
But to my problem. I'm trying to get the same system working on the Intranet server (Windows 2000, IIS5.0, MDAC 2.8 and part of the Domain), rather than my PC (Windows XP, SP2, .NET 1.1, Latest MDAC too, and part of the Domain, of which I am an Admin) in preperation for it going live. It was failing on an unspecified error, so I have broken the system into a manageable chunk to find the problem.
The code I'm using to to test is as follows:
<%@ Language=VBScript %>
<%
Option Explicit
Dim con,rs,Com,objADsPath,objDomain
%>
<html>
<head>
</head>
<body bgcolor="#CCCCCC">
<%
Set objDomain = GetObject ("GC://RootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select * from 'LDAP://"+objADsPath+"' WHERE objectCategory='person' AND sAMAccountName='*' order by name"
Set rs = Com.Execute
Do While Not rs.EOF Or rs.BOF
Response.Write rs(0) & "<BR>"
rs.MoveNext
Loop
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
%>
</body>
</html>
This code works fine, and I get a list of all the accounts back, in the format "LDAP://CN=The Name,OU=Whatever,DC=msl,DC=net".
If I want to actually retrieve back the particular details about someone then I obviously have to change my select statement.
So I change the line to:
Com.CommandText ="select sAMAccountName from 'LDAP://"+objADsPath+"' WHERE objectCategory='person' AND sAMAccountName='*' order by name"
I'm just trying to bring back the account name as a test. This results in the error:
Provider error '80004005'
Unspecified error
/test2.asp, line 20
I'm at my wits end here trying to get this working. Does anyone have any suggestions?
Many Thanks
Stephen
But to my problem. I'm trying to get the same system working on the Intranet server (Windows 2000, IIS5.0, MDAC 2.8 and part of the Domain), rather than my PC (Windows XP, SP2, .NET 1.1, Latest MDAC too, and part of the Domain, of which I am an Admin) in preperation for it going live. It was failing on an unspecified error, so I have broken the system into a manageable chunk to find the problem.
The code I'm using to to test is as follows:
<%@ Language=VBScript %>
<%
Option Explicit
Dim con,rs,Com,objADsPath,objDomain
%>
<html>
<head>
</head>
<body bgcolor="#CCCCCC">
<%
Set objDomain = GetObject ("GC://RootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select * from 'LDAP://"+objADsPath+"' WHERE objectCategory='person' AND sAMAccountName='*' order by name"
Set rs = Com.Execute
Do While Not rs.EOF Or rs.BOF
Response.Write rs(0) & "<BR>"
rs.MoveNext
Loop
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
%>
</body>
</html>
This code works fine, and I get a list of all the accounts back, in the format "LDAP://CN=The Name,OU=Whatever,DC=msl,DC=net".
If I want to actually retrieve back the particular details about someone then I obviously have to change my select statement.
So I change the line to:
Com.CommandText ="select sAMAccountName from 'LDAP://"+objADsPath+"' WHERE objectCategory='person' AND sAMAccountName='*' order by name"
I'm just trying to bring back the account name as a test. This results in the error:
Provider error '80004005'
Unspecified error
/test2.asp, line 20
I'm at my wits end here trying to get this working. Does anyone have any suggestions?
Many Thanks
Stephen