explodeDN() public method

return a string array of the individual RDNs contained in the DN
public explodeDN ( bool noTypes ) : System.String[]
noTypes bool If true, returns only the values of the /// components, and not the names, e.g. "Babs /// Jensen", "Accounting", "Acme", "us" - instead of /// "cn=Babs Jensen", "ou=Accounting", "o=Acme", and /// "c=us". ///
return System.String[]
		/// <summary>
		/// Initializes the Entry specific properties e.g entry DN etc.
		/// </summary>
		void InitEntry()
		{			
			LdapUrl lUrl = new LdapUrl (ADsPath);
			string dn = lUrl.getDN();
			if (dn != null ) {
				if (String.Compare (dn,"rootDSE",true) == 0)
					InitToRootDse (lUrl.Host,lUrl.Port);
				else {
				DN userDn = new DN (dn);
				String[] lRdn = userDn.explodeDN(false);
				_Name = (string)lRdn[0];
				_Parent = new DirectoryEntry(conn);
				_Parent.Path = GetLdapUrlString (lUrl.Host,lUrl.Port,userDn.Parent.ToString ());
				}
			}
			else			{
				_Name=lUrl.Host+":"+lUrl.Port;
				_Parent = new DirectoryEntry(conn);
				_Parent.Path = "Ldap:";
			}
		}
Exemplo n.º 2
0
		/// <summary> Returns the individual components of a distinguished name (DN).
		/// 
		/// </summary>
		/// <param name="dn">       The distinguished name, for example, "cn=Babs
		/// Jensen,ou=Accounting,o=Acme,c=US"
		/// 
		/// </param>
		/// <param name="noTypes">  If true, returns only the values of the
		/// components and not the names.  For example, "Babs
		/// Jensen", "Accounting", "Acme", "US" instead of
		/// "cn=Babs Jensen", "ou=Accounting", "o=Acme", and
		/// "c=US".
		/// 
		/// </param>
		/// <returns> An array of strings representing the individual components
		/// of a DN, or null if the DN is not valid.
		/// </returns>
		public static System.String[] explodeDN(System.String dn, bool noTypes)
		{
			DN dnToExplode = new DN(dn);
			return dnToExplode.explodeDN(noTypes);
		}
		/// <summary>
		/// Initializes the Entry specific properties e.g entry DN etc.
		/// </summary>
		void InitEntry()
		{
			LdapUrl lUrl=new LdapUrl (Path);
			if(lUrl.getDN()!=null)			{
				DN userDn = new DN(lUrl.getDN());
				String[] lRdn = userDn.explodeDN(false);
				_Name = (string)lRdn[0];
				_Parent = new DirectoryEntry(conn);
				LdapUrl cUrl=new LdapUrl(lUrl.Host,lUrl.Port,userDn.Parent.ToString());
				_Parent.Path=cUrl.ToString();
			}
			else			{
				_Name=lUrl.Host+":"+lUrl.Port;
				_Parent = new DirectoryEntry(conn);
				_Parent.Path = "Ldap:";
			}
		}