[python-win32] ADO/ADSI script works, but not in ASP

Wilbert, Matt (ENV) Matt.Wilbert@state.ma.us
Thu, 27 Feb 2003 15:27:09 -0500


Jens,

I had what I thought were good reasons for not believing that--
I tried setting names/passwords in the connection object,
connection doesn't fail, error didn't look much like an
access problem--but after I got your message I created a local
account on the server and it appears to have the same problem
interactively.

So this doesn't look like a Python-win32 problem at all;
I probably just have to figure out how to authenticate to
AD correctly.

Thanks for getting me to look in the right place.

Matt

-----Original Message-----
From: Jens B. Jorgensen [mailto:jens.jorgensen@tallan.com]
Sent: Thursday, February 27, 2003 1:41 PM
To: Wilbert, Matt (ENV)
Cc: python-win32@python.org
Subject: Re: [python-win32] ADO/ADSI script works, but not in ASP


Could it be a permissions problem? The user account an ASP runs under=20
does not have the same rights you do on the desktop.

Wilbert, Matt (ENV) wrote:

>I am having a problem getting Active Directory information from within =
an ASP page.
>It may help you to know that I have very limited experience with ASP.
>This running under Windows 2000, IIS 5, ActivePython 2.2.1  MDAC 2.6.
>
>I have constructed a minimal example.
>
>If open the page below, I get at "table does not exist" error (full =
error message also below)
>If I call smallTestTable() from a regular python script on the same =
server, it works as expected.
>I presume there is some additional magic you need to do in ASP, but I =
have been unable to figure
>out what that magic is.
>
>Thanks for any insights you may have,
>
>Matt Wilbert
>-----------------test.asp ---------------------------
><HTML>
><BODY>
><table>
><%=3DsmallTestTable%>
></table>
></BODY>
></HTML>
>
><SCRIPT Language=3D"Python" RunAt=3D"Server">
>import win32com.client
>
>def smallTestTable():
>    conn =3D win32com.client.Dispatch('ADODB.Connection')
>    conn.Provider =3D "ADSDSOObject"
>    conn.Open()
>    command =3D """Select Name, =
objectClass,GivenName,sn,telephoneNumber FROM
>             'LDAP://dc=3Denv,dc=3Dgovt,dc=3Dstate,dc=3Dma,dc=3Dus'=20
>	where objectClass =3D 'User' and sn =3D'Wilbert"""
>    (rs,success) =3D conn.Execute(command)
>    rs.MoveFirst()
>    rs.MoveLast()
>    returnText =3D "<tr><td>%d</td><td>%d</td></tr>\n" % =
(rs.Fields.Count, rs.RecordCount)
>    rs.Close()
>    conn.Close()
>    return returnText
>
></SCRIPT>
>----------end test.asp-------------------
>
>Error Type:
>Python ActiveX Scripting Engine (0x80020009)
>Traceback (innermost last): File "<Script Block >",
> line 7, in smallTestTable (rs,success) =3D conn.Execute(command) File =
"C:\Python22\Lib\site-packages\win32\ADO.py",
> line 1808, in Execute return self._ApplyTypes_(0x6, 1, (9, 0), ((8, =
1), (16396, 18), (3, 49)), 'Execute', =
'{00000556-0000-0010-8000-00AA006D2EA4}',CommandText, RecordsAffected, =
Options) File =
"C:\Python22\Lib\site-packages\win32com\client\__init__.py",
> line 341, in _ApplyTypes_ return =
self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid, 0, =
wFlags, retType, argTypes) + args), user, resultCLSID) COM Error: Table =
does not exist.
>
>
>
>_______________________________________________
>Python-win32 mailing list
>Python-win32@python.org
>http://mail.python.org/mailman/listinfo/python-win32
> =20
>

--=20
Jens B. Jorgensen
jens.jorgensen@tallan.com

"With a focused commitment to our clients and our people, we deliver =
value through customized technology solutions" =20