private void InitToRootDse(string host,int port)
{
if ( host == null )
host = DefaultHost;
if ( port < 0 )
port = DefaultPort;
LdapUrl rootPath = new LdapUrl (host,port,String.Empty);
string [] attrs = new string [] {"+","*"};
DirectoryEntry rootEntry = new DirectoryEntry (rootPath.ToString (),this.Username,this.Password,this.AuthenticationType);
DirectorySearcher searcher = new DirectorySearcher (rootEntry,null,attrs,SearchScope.Base);
SearchResult result = searcher.FindOne ();
// copy properties from search result
PropertyCollection pcoll = new PropertyCollection ();
foreach (string propertyName in result.Properties.PropertyNames) {
System.Collections.IEnumerator enumerator = result.Properties [propertyName].GetEnumerator ();
if (enumerator != null)
while (enumerator.MoveNext ())
if (String.Compare (propertyName,"ADsPath",true) != 0)
pcoll [propertyName].Add (enumerator.Current);
}
this.SetProperties (pcoll);
this._Name = "rootDSE";
}