DirectoryServices error!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Enosh Chang

    #1

    DirectoryServices error!

    Hi all,

    I encounter some problem in DirectoryServic es, could someone help me?

    private void InitLoginUser()
    {
    DirectoryEntry objEntry = new DirectoryEntry( );
    DirectorySearch er objSearcher = new DirectorySearch er();
    SearchResult objResult;

    try
    {
    objEntry.Path = "LDAP://dc=iec,dc=inven tec";

    objSearcher.Sea rchRoot = objEntry;
    objSearcher.Fil ter = "(sAMAccountNam e=*464*)";
    objSearcher.Sea rchScope = SearchScope.Sub tree;
    objSearcher.Pro pertiesToLoad.A dd("displayName ");
    objResult = objSearcher.Fin dOne();
    } // try
    finally
    {
    } // finally
    }

    private void Page_Load(objec t sender, System.EventArg s e)
    {
    // ±N¨Ï¥ÎªÌµ{¦¡½X¸ m©ó¦¹¥Hªì©l¤Æºô ­¶
    if (!IsPostBack)
    InitLoginUser() ;
    }

    But it always show error message as following:

    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: The
    specified domain either does not exist or could not be contacted

    Source Error:

    An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of the
    exception can be identified using the exception stack trace below.

    Stack Trace:

    [COMException (0x8007054b): The specified domain either does not exist or
    could not be contacted]
    System.Director yServices.Direc toryEntry.Bind( Boolean throwIfFail) +514
    System.Director yServices.Direc toryEntry.Bind( ) +10
    System.Director yServices.Direc toryEntry.get_A dsObject() +10
    System.Director yServices.Direc torySearcher.Fi ndAll(Boolean
    findMoreThanOne ) +199
    System.Director yServices.Direc torySearcher.Fi ndOne() +31
    MailTracking.We bForm1.InitLogi nUser() in
    c:\inetpub\wwwr oot\mailtrackin g\default.aspx. cs:35
    MailTracking.We bForm1.Page_Loa d(Object sender, EventArgs e) in
    c:\inetpub\wwwr oot\mailtrackin g\default.aspx. cs:46
    System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
    System.Web.UI.C ontrol.LoadRecu rsive() +29
    System.Web.UI.P age.ProcessRequ estMain() +724


    Anyway, thanks all!



  • Natty Gur

    #2
    Re: DirectoryServic es error!

    Hi,

    you need to write the full domain name with DCs

    For example if the domin name is microsoft.com it should be :

    DC=microsoft,DC =com

    Connect to computers in a domain. For example, "LDAP://CN=
    computer-name, CN=Computers, DC= domain-controller1, DC=
    domain-controller2,... ".



    Natty Gur, CTO
    Dao2Com Ltd.
    34th Elkalay st. Raanana
    Israel , 43000
    Phone Numbers:
    Office: +972-(0)9-7740261
    Fax: +972-(0)9-7740261
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    Working...