System.Runtime.InteropServices.COMException in WebPart

Discussion in 'ASP .Net Security' started by sekhar mantrala via .NET 247, Jun 1, 2005.

  1. I too got the same problem accessing the active directory while trying from a webpart in share point portal server. The sample code is as follows...

    DirectoryEntry entry = new DirectoryEntry("GC://corp.microsoft.com");
    DirectorySearcher dSearch = new DirectorySearcher(entry);
    dSearch.Filter = ("(&(objectClass=user)(SAMAccountName= " + UserAlias + "))");
    SearchResultCollection result = dSearch.FindAll(); //////////the error occurs here
    dSearch.PropertiesToLoad.Add("samaccountname");
    foreach(SearchResult sResultSet in dSearch.FindAll()) ////////the error occurs here

    The same code works fine in a seperate web application/windows application.

    Can anyone have any idea why this happens and help me in identifying the issue?

    Thanks in advance

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>S1tcW2Ubk0m/LRCtzmxsOg==</Id>
     
    sekhar mantrala via .NET 247, Jun 1, 2005
    #1
    1. Advertising

  2. What is the error and the stack trace? I'm guessing you too are having a
    double hop issue, but it is hard to say.

    Joe K.

    "sekhar mantrala via .NET 247" <> wrote in message
    news:%...
    >I too got the same problem accessing the active directory while trying from
    >a webpart in share point portal server. The sample code is as follows...
    >
    > DirectoryEntry entry = new DirectoryEntry("GC://corp.microsoft.com");
    > DirectorySearcher dSearch = new DirectorySearcher(entry);
    > dSearch.Filter = ("(&(objectClass=user)(SAMAccountName= " + UserAlias +
    > "))");
    > SearchResultCollection result = dSearch.FindAll(); //////////the error
    > occurs here
    > dSearch.PropertiesToLoad.Add("samaccountname");
    > foreach(SearchResult sResultSet in dSearch.FindAll()) ////////the error
    > occurs here
    >
    > The same code works fine in a seperate web application/windows
    > application.
    >
    > Can anyone have any idea why this happens and help me in identifying the
    > issue?
    >
    > Thanks in advance
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    >
    > <Id>S1tcW2Ubk0m/LRCtzmxsOg==</Id>
     
    Joe Kaplan \(MVP - ADSI\), Jun 1, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mily
    Replies:
    0
    Views:
    5,101
  2. Dave
    Replies:
    2
    Views:
    733
  3. akshar108
    Replies:
    3
    Views:
    3,920
    Mark Rae [MVP]
    Sep 15, 2007
  4. rockdale
    Replies:
    0
    Views:
    885
    rockdale
    Jan 3, 2008
  5. jens
    Replies:
    0
    Views:
    318
Loading...

Share This Page