Web Parts messing with my LDAP query

M

Mark C James

Forgive me if this isn't the correct area to post this. The problem deals with

Visual Studio Web page development
LDAP queries
Web-Parts.

I developed a web page that works great. It searches and grabs phone numbers
via LDAP. The code in question;

objCommand.CommandText = _
"SELECT
givenName,SN,telephoneNumber,mobile,facsimileTelephoneNumber," & _
"extensionAttribute4,department,samAccountName,
userAccountControl FROM " & _
"'LDAP://dc=mydc,dc=myorg' " & _
"WHERE objectCategory='User' AND objectClass = 'Person' AND " &
Query

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objRecordSet = objCommand.Execute
 
M

Mark C James

A little more info.

Above the first line of VB code below are the following lines;

objConnection = CreateObject("ADODB.Connection")
objCommand = CreateObject("ADODB.COmmand")
objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = "MyUserName"
objConnection.Properties("Password") = "MyPasswod"
objConnection.Open("Active Directory Provider")
objCommand.ActiveConnection = objConnection

What wasn't there before were the "User ID" and "Password" lines. With these
lines, the code works.

Now my question is, why if this were just a plain web-page without web-parts
would this code work without identifying myself, but when I place it into a
web-part, it DOES require me to identify myself. I don't want to hard-code a
dummy username and password into this routine. How do I get the web-parts to
assume the person running the page is the credentials it should be using?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top