DirectoryEntry.Password DirectoryEntry.Password DirectoryEntry.Password DirectoryEntry.Password Property

Definición

Establece la contraseña que se va a utilizar para autenticar el cliente.Sets the password to use when authenticating the client.

public:
 property System::String ^ Password {  void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
[System.DirectoryServices.DSDescription("DSPassword")]
public string Password { set; }
member this.Password : string
Public Property Password As String

Valor de propiedad

Contraseña que se va a usar para autenticar el cliente.The password to use when authenticating the client.

Ejemplos

En el ejemplo siguiente se muestra el Username y Password propiedades de la DirectoryEntry clase.The following example demonstrates the Username and Password properties of the DirectoryEntry class. En este ejemplo obtiene el especificado por el usuario DirectoryEntry y Path de todos sus Children.This example gets the user-specified DirectoryEntry and the Path of all its Children.

Dim myADSPath As String = _  
      "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"  

' Create an Instance of DirectoryEntry.  
Dim myDirectoryEntry As New DirectoryEntry(myADSPath)  
myDirectoryEntry.Username = UserName  
myDirectoryEntry.Password = SecurelyStoredPassword  

' Get the Child ADS objects.  
Console.WriteLine("The Child ADS objects are:")  
Dim myChildDirectoryEntry As DirectoryEntry  
For Each myChildDirectoryEntry In  myDirectoryEntry.Children  
   Console.WriteLine(myChildDirectoryEntry.Path)  
Next myChildDirectoryEntry   
String myADSPath = "LDAP://onecity/CN=Users,  
         DC=onecity,DC=corp,DC=fabrikam,DC=com";  

// Create an Instance of DirectoryEntry.  
DirectoryEntry myDirectoryEntry = new DirectoryEntry(myADSPath);  
myDirectoryEntry.Username = UserName;  
myDirectoryEntry.Password = SecurelyStoredPassword;  

// Get the Child ADS objects.  
Console.WriteLine("The Child ADS objects are:");  
foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)  
   Console.WriteLine(myChildDirectoryEntry.Path);  
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";  

// Create an Instance of DirectoryEntry.  
DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);  
myDirectoryEntry->Username = UserName;  
myDirectoryEntry->Password = SecurelyStoredPassword;  

// Get the Child ADS objects.  
Console::WriteLine("The Child ADS objects are:");  
Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();  
while (myEnum->MoveNext())   
{  
    DirectoryEntry^ myChildDirectoryEntry = safe_cast<DirectoryEntry^>  
             (myEnum->Current);  
    Console::WriteLine(myChildDirectoryEntry->Path);  
}  

Comentarios

Puede establecer el Username y Password propiedades para especificar credenciales alternativas para tener acceso a la información de Active Directory Domain Services.You can set the Username and Password properties to specify alternate credentials with which to access the information in Active Directory Domain Services. Cualquier otro DirectoryEntry recuperan los objetos de esta instancia (por ejemplo, mediante Children) se crean automáticamente con las mismas credenciales alternativas.Any other DirectoryEntry objects retrieved from this instance (for example, through Children) are automatically created with the same alternate credentials.

Se aplica a

Consulte también: