W
webbertsolutions
I am having troubles accessing a different Domain Controller than the one
I am currently in. Any help would be appreciated.
Dave
=================================================
Access DC_1 Access DC_2
Machine_1 in Domain_1 Works Exception
Machine_2 in Domain_2 Exception Works
The Exception is the same for both:
ex.Message -> "[exception] Error occurred while retrieving Active Directory display name (displayname)."
ex.InnerException -> "Handling of this ADSVALUE type is not yet implemented (type = 0xb)."
AdminID Password
=======================
DC_1 Unknown Unknown
DC_2 known known
Code -- Use UserID and Password If known
=================================================
string ldapAdminID = ConfigurationSettings.AppSettings["User"];
string ldapAdminPwd = ConfigurationSettings.AppSettings["Pwd"];
AuthenticationTypes AD_TYPE = AuthenticationTypes.Secure;
if ((ldapAdminID == null) || (ldapAdminID.Trim().Equals(String.Empty)))
entry = new DirectoryEntry(path);
else
entry = new DirectoryEntry(path, ldapAdminID, ldapAdminPwd, AD_TYPE);
DirectorySearcher searcher = new DirectorySearcher( entry );
searcher.Filter = String.Format( AD_SEARCH_EXPRESSION, m_LogonID );
searcher.PropertiesToLoad.AddRange(
new string[] { displayNamePropertyName, groupsPropertyName } );
SearchResult result = searcher.FindOne();
if ( result != null )
{
// THIS LINE THROWS AN EXCEPTION
displayName = result.Properties["displayname"][0].ToString();
// ex.Message -> "[exception] Error occurred while retrieving Active Directory display name (displayname)."
// ex.InnerException -> "Handling of this ADSVALUE type is not yet implemented (type = 0xb)."
}
Using the watch window, these are the values of the SearchResult
========================================================================
result.Properties.Hashtable.KeyCollection._hashtable
["adspath"]
["displayname"]
result.Properties["adspath"]
Item -> <cannot view indexed property>
System.Collections.ICollection.ReadOnlyCollectionBase
list {Count=0x1}
list[0] -> "LDAP://aaaa/CN=bbbbb,CN=Users,DC=aaaa,DC=com"
result.Properties["displayname"]
Item -> <cannot view indexed property>
System.Collections.ICollection.ReadOnlyCollectionBase
list {Count=0x1}
list[0] -> {System.NotImplementedException}
System.SystemException -> {"Handling of this ADSVALUE type is not yet implemented (type = 0xb)."}
I am currently in. Any help would be appreciated.
Dave
=================================================
Access DC_1 Access DC_2
Machine_1 in Domain_1 Works Exception
Machine_2 in Domain_2 Exception Works
The Exception is the same for both:
ex.Message -> "[exception] Error occurred while retrieving Active Directory display name (displayname)."
ex.InnerException -> "Handling of this ADSVALUE type is not yet implemented (type = 0xb)."
AdminID Password
=======================
DC_1 Unknown Unknown
DC_2 known known
Code -- Use UserID and Password If known
=================================================
string ldapAdminID = ConfigurationSettings.AppSettings["User"];
string ldapAdminPwd = ConfigurationSettings.AppSettings["Pwd"];
AuthenticationTypes AD_TYPE = AuthenticationTypes.Secure;
if ((ldapAdminID == null) || (ldapAdminID.Trim().Equals(String.Empty)))
entry = new DirectoryEntry(path);
else
entry = new DirectoryEntry(path, ldapAdminID, ldapAdminPwd, AD_TYPE);
DirectorySearcher searcher = new DirectorySearcher( entry );
searcher.Filter = String.Format( AD_SEARCH_EXPRESSION, m_LogonID );
searcher.PropertiesToLoad.AddRange(
new string[] { displayNamePropertyName, groupsPropertyName } );
SearchResult result = searcher.FindOne();
if ( result != null )
{
// THIS LINE THROWS AN EXCEPTION
displayName = result.Properties["displayname"][0].ToString();
// ex.Message -> "[exception] Error occurred while retrieving Active Directory display name (displayname)."
// ex.InnerException -> "Handling of this ADSVALUE type is not yet implemented (type = 0xb)."
}
Using the watch window, these are the values of the SearchResult
========================================================================
result.Properties.Hashtable.KeyCollection._hashtable
["adspath"]
["displayname"]
result.Properties["adspath"]
Item -> <cannot view indexed property>
System.Collections.ICollection.ReadOnlyCollectionBase
list {Count=0x1}
list[0] -> "LDAP://aaaa/CN=bbbbb,CN=Users,DC=aaaa,DC=com"
result.Properties["displayname"]
Item -> <cannot view indexed property>
System.Collections.ICollection.ReadOnlyCollectionBase
list {Count=0x1}
list[0] -> {System.NotImplementedException}
System.SystemException -> {"Handling of this ADSVALUE type is not yet implemented (type = 0xb)."}