how to retrive ldap data into a asp grid

javascript India
  • 13 years ago

    Hi i connect to asp page to LDAP and i displayed  LDAP data into asp form i am new to asp and also LDAP

    i know how to connect asp  grid to  database . But I dont know how to connect asp grid to LDAP

    any body help me please its urgent please

    This is my code i displayed LDAP data in asp form. How to display  LDAP data in a drid

    LDAP as database please anybody help me

    private

    void Button1_Click(object sender, System.EventArgs e)

    {

    string path = "LDAP://localhost:2389/ou=globalaci,cn=config";

    //OleDbDataAdapter DA= new System.Data.OleDb.OleDbDataAdapter(path,entry);

    DirectoryEntry entry =

    new DirectoryEntry(path);

    DirectorySearcher search =

    new DirectorySearcher(entry,"(objectClass=*)");

    //DataSet ds = FindUsers(search,columns,path,true);

    //DataGrid1.DataSource=ds;

    //DataGrid1.DataBind();

    foreach(SearchResult result in search.FindAll())

    {

    DirectoryEntry dirEntry = result.GetDirectoryEntry();

    foreach(string key in dirEntry.Properties.PropertyNames)

    {

    foreach( object propVal in dirEntry.Properties[key] )

    {

    Response.Write(key + " = " + propVal);

    //Response.Write("error occured in this page");

    }

    }

    Response.Write("----");

    }

    try

    {

    Object native = entry.NativeObject;

    Response.Write("User authenticated!");

    }

    catch( Exception ex )

    {

    Response.Write(ex.StackTrace);

    }

    }

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard