System.Runtime.InteropServices.COMException in WebPart

  • Thread starter sekhar mantrala via .NET 247
  • Start date
S

sekhar mantrala via .NET 247

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
 
J

Joe Kaplan \(MVP - ADSI\)

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top