You cannot use the DirectorySearcher.FindOne().GetDirectoryEntry() method to bind a new DirectoryEntry object in the .NET Framework 1.0 (327442)
The information in this article applies to:
- Microsoft .NET Framework 1.0
- Microsoft Visual Studio .NET (2002), Professional Edition
This article was previously published under Q327442 SYMPTOMSA problem may occur when you try to use the DirectoryEntry.Name property after you define a "DirectoryEntry." The following code example shows the code that makes the problem occur. DirectoryEntry dirEntry = dirSearch.FindOne().GetDirectoryEntry(); When you try to use the DirectoryEntry.Name property after you define a "DirectoryEntry," you may receive the following error message: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll
Additional information: The server is not operational
CAUSEThis problem may occur if the System.DirectoryServices call is run with insufficient permissions.
The DirectorySearcher class runs under the credentials that are specified in the DirectoryEntry object that is used as the "searchroot" of the DirectorySearcher class. However, these credentials are not used when the SearchResult.GetDirectoryEntry call is made. The SearchResult.GetDirectoryEntry call is made by using the security context of the calling process.WORKAROUNDTo work around this problem, locate the following code example. DirectoryEntry dirEntry = dirSearch.FindOne().GetDirectoryEntry();
Replace the previous code example with the following code example. DirectoryEntry dirEntry = new DirectoryEntry( dirSearch.FindOne().Path, searchRoot.Username, searchRoot.Password, searchRoot.AuthenticationType ) ;
STATUS
This behavior is by design.
This problem is resolved in the Microsoft .NET Framework 1.1.REFERENCESFor additional information about the DirectorySearcher class, visit the following Microsoft Developer Network (MSDN) Web site:
Modification Type: | Major | Last Reviewed: | 10/12/2004 |
---|
Keywords: | kbtshoot kberrmsg kbProgramming kbprb KB327442 kbAudDeveloper |
---|
|