locked
To access active directory to get all users from a server which is located remotely RRS feed

  • General discussion

  • I got a requirement to retrieve all users from active directory which is installed on a remote server.

    I have been provided with the ip address, domain name as some abc.local, username and password.

    I tried

     DirectoryEntry domain1 = new DirectoryEntry("LDAP://ip address/DC=abc,DC=local", "username", "password",AuthenticationTypes.ReadonlyServer);

    domain1.RefreshCache();

    I am getting error as 


    [COMException (0x8007203a): The server is not operational.
    ]
       System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +387793
       System.DirectoryServices.DirectoryEntry.Bind() +36
       System.DirectoryServices.DirectoryEntry.RefreshCache() +45
       Default4.Button1_Click(Object sender, EventArgs e) in d:\curary systems\activedirectory\Default4.aspx.cs:27
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9552602
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

    can anyone suggest me some solution?

    [COMException (0x8007203a): The server is not operational.
    ]
       System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +387793
       System.DirectoryServices.DirectoryEntry.Bind() +36
       System.DirectoryServices.DirectoryEntry.RefreshCache() +45
       Default4.Button1_Click(Object sender, EventArgs e) in d:\curary systems\activedirectory\Default4.aspx.cs:27
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9552602
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    [COMException (0x8007203a): The server is not operational.
    ]
       System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +387793
       System.DirectoryServices.DirectoryEntry.Bind() +36
       System.DirectoryServices.DirectoryEntry.RefreshCache() +45
       Default4.Button1_Click(Object sender, EventArgs e) in d:\curary systems\activedirectory\Default4.aspx.cs:27
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9552602
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    Tuesday, August 20, 2013 1:49 PM