locked
need help with vlv search RRS feed

  • Question

  • User-974702580 posted

    Hello,

    I was trying to implement vlv search based on examples in this forum, but I getting the error every time I trying to run this:

    (running on win 2003 server with asp.net 2.0)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    Error:

    A directory service error has occurred.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: A directory service error has occurred.


    Source Error:

    Line 18:         For Each result In results
    Line 19:             Response.Write(result.ToString)
    Line 20:         Next
    Line 21: 
    Line 22:     End Sub

    Source File: C:\websites\PhoneBook\phonebookbbuild\test.aspx.vb    Line: 20

    Stack Trace:

    [COMException (0x80072095): A directory service error has occurred.
    ]
       System.DirectoryServices.ResultsEnumerator.MoveNext() +664
       test.Page_Load(Object sender, EventArgs e) in C:\websites\PhoneBook\phonebookbbuild\test.aspx.vb:20
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +47
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
    


     

     

     

    Code:

    Dim searchRoot = New DirectoryServices.DirectoryEntry("LDAP://berger.system.matrix", "domain\username", "password", AuthenticationTypes.Secure)

    Dim qry = String.Format("(&(objectCategory=person)(name={0}*))", "d")

    Dim columns() As String = {"givenName", "sn", "userPrincipalName", "physicalDeliveryOfficeName", "telephoneNumber", "department"}

    Dim search As DirectorySearcher = New DirectorySearcher(searchRoot, qry, columns)

    search.VirtualListView = New DirectoryServices.DirectoryVirtualListView(1, 4, 2)

    Dim results As DirectoryServices.SearchResultCollection = search.FindAll()

    Dim result As DirectoryServices.SearchResult

    For Each result In results

    Response.Write(result.ToString)

    Next

    End Sub

    Please HELP, WHAT AM I DOING WRONG...

    THANK YOU...

    Wednesday, February 15, 2006 10:41 AM

All replies

  • User1354132231 posted
    VLV requires using DirectorySearcher.SortOption or the server doesn't know how to present for Target searches.  Just make sure you are sorting the resultset on an attribute and it should work.

    Unofficially, I have heard that VLV is broken in W2k3 (working in ADAM, however).  I don't have a lot of details, but that is the rumor...
    Wednesday, February 15, 2006 12:56 PM