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

Jens B. Jorgensen jens.jorgensen@tallan.com
Thu, 27 Feb 2003 15:30:38 -0600


This is a cryptographically signed message in MIME format.

--------------ms000408090408000905020907
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

No problem Matt. In fact if you need to authenticate to the AD you can 
use an alternate interface. I'm going to send you a script I use in 
private email. If anyone else is interested in this stuff I can send it 
to you too.

Wilbert, Matt (ENV) wrote:

>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 
>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>
>><%=smallTestTable%>
>></table>
>></BODY>
>></HTML>
>>
>><SCRIPT Language="Python" RunAt="Server">
>>import win32com.client
>>
>>def smallTestTable():
>>   conn = win32com.client.Dispatch('ADODB.Connection')
>>   conn.Provider = "ADSDSOObject"
>>   conn.Open()
>>   command = """Select Name, objectClass,GivenName,sn,telephoneNumber FROM
>>            'LDAP://dc=env,dc=govt,dc=state,dc=ma,dc=us' 
>>	where objectClass = 'User' and sn ='Wilbert"""
>>   (rs,success) = conn.Execute(command)
>>   rs.MoveFirst()
>>   rs.MoveLast()
>>   returnText = "<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) = 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
>> 
>>
>>    
>>
>
>  
>

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

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


--------------ms000408090408000905020907
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIIkjCC
AqcwggIQoAMCAQICAwf4vDANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCWkExFTATBgNV
BAgTDFdlc3Rl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