Tuesday, April 21, 2009

The administrative limit for this request was Exceeded - LDAP

Last week I was writing an ASP page that fetched information from Active Directory using LDAP queries.

It was a straight forward page - the manager from the client side wanted to check some attributes. I wrote the asp code and began to test it. That’s when this error popped up, after processing the page halfway through:

“The administrative limit for this request was

The error was self-explanatory and also the error popped up exactly after fetching 499 records. I was quite certain of the issue, but I just wanted to know if I had to access 500 records at a time by modifying the query or could the ADODB Command object (which I was using) do the trick.

Googled it quickly and got the answer – setting the page size on the Command object was enough:

comm.Properties("Page Size") = 100

The Code snippet for reference purpose:

Dim rs
Dim conn, strSQL
Dim dictDeptList, szUserID, szUserName, intDeptID
Dim comm

szCountry = Request.Form("CountrySelCtl")

strSQL = "select cn, " & CONST_TEL_KEY & _
" from '" & GetMemberContainerPath & "/ou=" & szCountry & "' where objectClass='Member' "

Set conn = Server.CreateObject("ADODB.Connection")conn.Provider = "ADsDSOObject"conn.Open "ADs Provider", Application("AD_UserName"), Application("AD_Password")

Set comm = Server.CreateObject("ADODB.Command")
Set comm.ActiveConnection = conncomm.CommandText = strSql
' Removes the Max Allowed Restriction
comm.Properties("Page Size") = 100

Set rs = comm.Execute()
Post a Comment