Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2003, 08:22 PM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default LDAP search form

Hi.

I have done up a working LDAP search form using ASP, but it only seems to work on my local computer, and not on others who are on the network. We are using Windows XP and IE.

Please see below for the code.
--------
Code:
<form method="POST" action="searchResult.asp">
   <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="1">
      <tr>                   
         <td width="11%" height="19">Enter Name:</td>
         <td width="25%" height="19"> <input type="text" name="surnameField" size="20">
            <input type="submit" value="Submit" name="B1"></td>
         <td width="64%" height="19"> </td>
      </tr>
      <tr>                   
         <td width="11%" height="19"> </td>
         <td width="25%" height="19">(eg: Yvonne, Tricia) </td>
         <td width="64%" height="19"> </td>
      </tr>
      <tr>
         <td width="11%" height="1"></td>
         <td width="25%" height="1"></td>
         <td width="64%" height="1"></td>
      </tr>
   </table>
</form>
--------
--------
Code:
<% 
   strServerName = "theservername"   
   strName = request.form("surnameField")
   if strName <> "" then    

   set oConn = CreateObject("ADODB.Connection")
   set oCommand = CreateObject("ADODB.Command")
   set oRS = CreateObject("ADODB.Recordset")

   oConn.Provider = "ADsDSOObject"
   oConn.Open "Ads Provider"

   set oCommand.ActiveConnection = oConn  'set the active connection

   strQuery= "<LDAP://" & strServername & ">;(givenName=" & strName & "*);cn,telephoneNumber,department;subtree"
   oCommand.CommandText = strQuery
   oCommand.Properties("Page Size") = 99   'a paged query is used to avoid Exchange LDAP server limits
   set oRS = oCommand.Execute   'Execute the query
   ...

--------
The error seems to point to the last line of the second code.

They have got the following Error Type:
- Active Directory (0x80040E37)
- An invalid directory pathname was passed.

Please help. Thanks! :D

YWT
__________________
YWT
 
Old June 5th, 2003, 09:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This isn't my area of expertise, but a couple of questions:
a) what type of authentication are you using for clients connecting to the webserver across the network?
b) is the error message you posted the *exact* error you are seeing on the screen? (the only reference I can find to that error number refer to non-existant table names...
 
Old June 6th, 2003, 12:13 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please see below for my reply.

a) I have enabled integrated Windows Authentication
b) Yup .. that was the error type. It threw me an error too .. Not sure if this would help.
-------
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
-------

The weird thing is that the code works on my computer but not on others. I have checked my form action directory and it points to the right direction.

~shrugs~ I really don't know what is wrong .. :(

YWT
 
Old August 14th, 2003, 04:03 AM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm . I am not working on ASP anymore .. doing Domino 6 now ...

Here is the code that I have used to make it work when I was using ASP. :)

Hope it helps someone. =)

Code:
<% 
   strServerName = "yourldapip"   
   strName = request.form("surnameField")
   if strName <> "" then    

   set oConn = CreateObject("ADODB.Connection")
   set oCommand = CreateObject("ADODB.Command")
   set oRS = CreateObject("ADODB.Recordset")

   oConn.Provider = "ADsDSOObject"
   oConn.Open "Ads Provider"

   set oCommand.ActiveConnection = oConn  'set the active connection

 ' Next we will build the LDAP query that will be used to retrieve the contents of the GAL.  
 ' We will specify which server we want to run the query against,
 ' a filter for what types of objects we are looking for, the attributes we would like
 ' returned, and the type of search
 ' A filter of (objectClass=person) will return mailboxes, distribution lists, and custom recipients

   strQuery= "<LDAP://" & strServername & ">;(&(telephoneNumber=65 *)(givenName=" & strName & "*));cn,telephoneNumber,department;subtree"
   oCommand.CommandText = strQuery
   oCommand.Properties("Page Size") = 99   'a paged query is used to avoid Exchange LDAP server limits
   set oRS = oCommand.Execute   'Execute the query

' Now we will loop through the results of our query 
'   and build a table to display the Global Address List
 
   if (not oRS.EOF) then
   %>  
   <TABLE BORDER=3>
   <TR bgcolor="#C0C0C0">
      <TH><b>Display Name</b></th>
      <TH><b>Phone</b></TH>
      <TH><b>Office</b></TH>
      <TH><b>Ext.</b></TH>    
   <%

   While not oRS.EOF
   %>
     <TR>
    <%
    ' Get the class of the object and set the appropriate color      
     %>     
     <TD><%=oRS.Fields("cn")%>
     <TD><%=oRS.Fields("telephoneNumber")%>
     <TD><%=oRS.Fields("department")%>
     <TD><%=right(oRS.Fields("telephoneNumber"), 3)%> 

   <%
   oRS.MoveNext
   wend

   else
   %> 

   <%
      response.write("No Contacts Found")
      end if   
   %>

   </td>
   </tr>
   </TABLE>

<%
   else 
%>

<%
      response.write("No Contacts Found")
   end if
%>
   <br><br>
<a class="class1" href="search.asp">Click here to Search again</a>
   </table>
</BODY>
</HTML>
YWT
 
Old October 1st, 2003, 02:45 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello! I had the same problem :

Here is the solution :

It's a problem of IIS which is a bad http server...There are two ways to make your page available from every computer :

You have to get the console managment for IIS (See in microsoft site if you dont have it). Then you have to modify the security of your asp file which make the ldap query.
1st solution :

enable anonymous access and specify a user who's got the rights to query the ldap server..But if I remember this solution make further problems with order etc...

2nd solution:

You have to disable the windows authentication, disable anonymous and only enable password protected (with clear password....(i dont know the exact translation, i have windows in french...also i am swiss..)but its the option in the middle....

The problem is that you'll have to enter the password every time...I am still looking for a solution but informations are very bad...
Also the user and password properties of ADO object cannot be used because you cannot get these informations from asp or IIS...And i have seen an example with SID , but still not working so....

Well I dont know why and where you develop your application, but an important thing is that with APACHE (www.apache.org (http server)) there is no such problem... And its a pity that microsoft cannot make his softwares work together!!!!!!!!!!

hope it was usefull... (i spent 3 weeks to get this solution...)And i am still experiencing problems in developing my asp application...



 
Old June 23rd, 2004, 06:09 PM
Registered User
 
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by yeewaitu
 Hi.

I have done up a working LDAP search form using ASP, but it only seems to work on my local computer, and not on others who are on the network. We are using Windows XP and IE.

Please see below for the code.
--------
Code:
<form method="POST" action="searchResult.asp">
   <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="1">
      <tr>                   
         <td width="11%" height="19">Enter Name:</td>
         <td width="25%" height="19"> <input type="text" name="surnameField" size="20">
            <input type="submit" value="Submit" name="B1"></td>
         <td width="64%" height="19"> </td>
      </tr>
      <tr>                   
         <td width="11%" height="19"> </td>
         <td width="25%" height="19">(eg: Yvonne, Tricia) </td>
         <td width="64%" height="19"> </td>
      </tr>
      <tr>
         <td width="11%" height="1"></td>
         <td width="25%" height="1"></td>
         <td width="64%" height="1"></td>
      </tr>
   </table>
</form>
--------
--------
Code:
<% 
   strServerName = "theservername"   
   strName = request.form("surnameField")
   if strName <> "" then    
   
   set oConn = CreateObject("ADODB.Connection")
   set oCommand = CreateObject("ADODB.Command")
   set oRS = CreateObject("ADODB.Recordset")

   oConn.Provider = "ADsDSOObject"
   oConn.Open "Ads Provider"

   set oCommand.ActiveConnection = oConn  'set the active connection

   strQuery= "<LDAP://" & strServername & ">;(givenName=" & strName & "*);cn,telephoneNumber,department;subtree"
   oCommand.CommandText = strQuery
   oCommand.Properties("Page Size") = 99   'a paged query is used to avoid Exchange LDAP server limits
   set oRS = oCommand.Execute   'Execute the query
   ...

--------
The error seems to point to the last line of the second code.

They have got the following Error Type:
- Active Directory (0x80040E37)
- An invalid directory pathname was passed.

Please help. Thanks! :D

YWT





Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent help needed in ldap search operation vidhyachat J2EE 0 May 12th, 2007 06:29 AM
Search Form? scandalous Access 8 February 8th, 2007 09:01 AM
Search in a sub form smang Access 1 January 7th, 2005 08:30 PM
Search Form ksa266 Access VBA 2 December 29th, 2003 06:37 AM
Creating A Search Form cdenequolo Classic ASP Basics 4 September 18th, 2003 02:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.