Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > System.Runtime.InteropServices.COMException in WebPart

Reply
Thread Tools

System.Runtime.InteropServices.COMException in WebPart

 
 
sekhar mantrala via .NET 247
Guest
Posts: n/a
 
      06-01-2005
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>
 
Reply With Quote
 
 
 
 
Joe Kaplan \(MVP - ADSI\)
Guest
Posts: n/a
 
      06-01-2005
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET 1.1 WebPart to .NET 2.0 WebPart anars ASP .Net 0 01-07-2007 07:31 PM
Does Visual Studio provides any free webpart to be used for Portals? Annie ASP .Net 3 09-04-2005 08:20 AM
Passing parameter between WebPart =?Utf-8?B?ZmE=?= ASP .Net 0 06-27-2005 07:10 PM
WebPart Portal Personalization? =?Utf-8?B?Y3RhZGxvY2s=?= ASP .Net 0 03-24-2005 01:59 AM
Web Service timeout from Sharepoint webpart Joe L via .NET 247 ASP .Net 0 06-17-2004 06:24 PM



Advertisments