DirectoryServices error!

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default DirectoryServices error!

    Hi all,

    I encounter some problem in DirectoryServices, could someone help me?

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

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

    objSearcher.SearchRoot = objEntry;
    objSearcher.Filter = "(sAMAccountName=*464*)";
    objSearcher.SearchScope = SearchScope.Subtree;
    objSearcher.PropertiesToLoad.Add("displayName");
    objResult = objSearcher.FindOne();
    } // try
    finally
    {
    } // finally
    }

    private void Page_Load(object sender, System.EventArgs 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.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) +514
    System.DirectoryServices.DirectoryEntry.Bind() +10
    System.DirectoryServices.DirectoryEntry.get_AdsObj ect() +10
    System.DirectoryServices.DirectorySearcher.FindAll (Boolean
    findMoreThanOne) +199
    System.DirectoryServices.DirectorySearcher.FindOne () +31
    MailTracking.WebForm1.InitLoginUser() in
    c:\inetpub\wwwroot\mailtracking\default.aspx.cs:35
    MailTracking.WebForm1.Page_Load(Object sender, EventArgs e) in
    c:\inetpub\wwwroot\mailtracking\default.aspx.cs:46
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +29
    System.Web.UI.Page.ProcessRequestMain() +724


    Anyway, thanks all!



    Enosh Chang Guest

  2. Similar Questions and Discussions

    1. Impersonation, DirectoryServices
      Do you get an UnauthorizedAccessException from the InnerException from the TargetInvocationException that gets thrown or something else? ...
    2. DirectoryServices Namespace
      Hi I am trying to import the System.DirectoryServices namespace in an aspx page with the following syntax <%@ Import...
    3. Sytem.DirectoryServices
      Add an assembly reference to it first. Joe K. "prakash s via .NET 247" <anonymous@dotnet247.com> wrote in message...
    4. System.DirectoryServices
      I have a few pages which authenticate a user to our site. Checking a login and password with syntax as below: Dim entry As New...
    5. ASP.NET + DirectoryServices
      Hi all, Could I use DirectoryServices in ASP.NET? Or could you give sample code? Thanks! Best Regards Enosh Chang
  3. #2

    Default Re: DirectoryServices 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 [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!

    Natty Gur Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139