An operations error occurred while accessing active directory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dhanashivam
    New Member
    • Mar 2007
    • 31

    An operations error occurred while accessing active directory

    hi all

    i am doing a web site with single sign on technique. I am getting the error "COMExcepti on (0x80072020): An operations error occurred" while executing the statement

    foreach (SearchResult AdObj in objsearch.FindA ll())

    I can run the application in the local server but not by remote client. so please tell me the solution for it.

    the code is:

    strAppPath = "LDAP://myServer/CN=user,CN=user s,DC=sample,DC= testprjs,DC=com "

    public bool authenticateUse r(string userName, string password)
    {
    DataTable dtDBUser = new DataTable("User InDB");
    dtDBUser.Column s.Add("UName");
    dtDBUser.Column s.Add("Pwd");
    dtDBUser.Column s.Add("UDomain" );

    DataRow dr;
    dr = dtDBUser.NewRow ();
    dr[0] = "gdhanasekaran" ;
    dr[1] = "dhana";
    dr[2] = "chennai";
    dtDBUser.Rows.A dd(dr);

    DirectoryEntry deRoot = new DirectoryEntry( strAppPath);
    DirectorySearch er objsearch = new DirectorySearch er();
    objsearch.Filte r = "(objectClass=u ser)";
    objsearch.Searc hScope = SearchScope.Sub tree;
    string strCN = "";
    foreach (SearchResult AdObj in objsearch.FindA ll())
    {
    strCN += //System.Director yServices.Activ eDirectory.Doma in.GetCurrentDo main().Name + "\n" +
    AdObj.Propertie s["SAMAccountName "][0] + "\n";
    if (userName == Convert.ToStrin g(AdObj.Propert ies["SAMAccountName "][0]))
    {
    if (dtDBUser.Selec t("UName = '" + userName + "' ").Length > 0)
    {
    return true;
    }
    else
    {
    return false;
    }
    }
    }
    return false;
    }

    Thanks in Advance.

    Regards,
    Dhanasekaran.G
  • dhanashivam
    New Member
    • Mar 2007
    • 31

    #2
    ASP.NET: Active Directory Accessing Error - An Operations Error Occured

    hi all

    i am doing a web site with single sign on technique. I am getting the error "COMExcepti on (0x80072020): An operations error occurred" while executing the statement

    foreach (SearchResult AdObj in objsearch.FindA ll())

    I can run the application in the local server but not by remote client. so please tell me the solution for it.

    the code is:

    strAppPath = "LDAP://myServer/CN=user,CN=user s,DC=sample,DC= testprjs,DC=com "

    public bool authenticateUse r(string userName, string password)
    {
    DataTable dtDBUser = new DataTable("User InDB");
    dtDBUser.Column s.Add("UName");
    dtDBUser.Column s.Add("Pwd");
    dtDBUser.Column s.Add("UDomain" );

    DataRow dr;
    dr = dtDBUser.NewRow ();
    dr[0] = "gdhanasekaran" ;
    dr[1] = "dhana";
    dr[2] = "chennai";
    dtDBUser.Rows.A dd(dr);

    DirectoryEntry deRoot = new DirectoryEntry( strAppPath);
    DirectorySearch er objsearch = new DirectorySearch er();
    objsearch.Filte r = "(objectClass=u ser)";
    objsearch.Searc hScope = SearchScope.Sub tree;
    string strCN = "";
    foreach (SearchResult AdObj in objsearch.FindA ll())
    {
    strCN += //System.Director yServices.Activ eDirectory.Doma in.Ge tCurrentDomain( ).Name + "\n" +
    AdObj.Propertie s["SAMAccountName "][0] + "\n";
    if (userName == Convert.ToStrin g(AdObj.Propert ies["SAMAccountName "][0]))
    {
    if (dtDBUser.Selec t("UName = '" + userName + "' ").Length > 0)
    {
    return true;
    }
    else
    {
    return false;
    }
    }
    }
    return false;
    }

    Thanks in Advance.

    Regards,
    Dhanasekaran.G

    Comment

    • dhanashivam
      New Member
      • Mar 2007
      • 31

      #3
      IIS: Permissions for Active Directory Users

      hi,

      i want to create an user account which will allow all the users to access the particular site. This user account is belogs to an Active Directory.

      So can you please tell me what are the permissions/ rights should be given for the user account to achieve the task.

      Thanks in Advance.

      Regards,
      Dhanasekaran. G

      Comment

      • radcaesar
        Recognized Expert Contributor
        • Sep 2006
        • 759

        #4
        http://www.pingzine.co m/blogs/?p=13

        Comment

        • dhanashivam
          New Member
          • Mar 2007
          • 31

          #5
          hi,

          thanks for your reply. but i could not achieve the task. The article describes how to make the web site as accesible for all the users.

          but i need to get the list of users from the active directory thru my web site. The site works fine while running from the server as well as not working from the remote machine.

          thats why i am requesting to create an user who has the permissions to access the active directory.

          please help me.

          Regards,
          Dhanasekaran. G

          Comment

          • dhanashivam
            New Member
            • Mar 2007
            • 31

            #6
            hi,

            i got conclusion for accessing the active directory.

            the IIS settings for the site which access the active directory should have the following.

            1. Check the Annonymous access

            2. Give a valid domain user name and its password in the specified portion.

            3. Clear Allow IIS to Control password.

            4. Check the Integrated Windows Authentication.

            5. Add the Impersonate = true in your web.config file.

            By these settings only you can read the users from the active directory.

            Absense of anyone will not allow you to access the active directory

            Regards,
            Dhanasekaran. G[/QUOTE]

            Comment

            Working...