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
Exceeded”

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()

2 comments:

Anonymous said...

Did you get any Answer for it. i am also facing same issue.

Karthik Padmanabhan said...

I thought I have posted the answer already...

Still - do you have the right username and password that has access to the Active Directory?

If I remember correctly, my problem was it was not able to retrieve them all beyond 499 records.