DirectoryEntry.Username Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Recupera o imposta il nome utente da usare quando si autentica il client.
public:
property System::String ^ Username { System::String ^ get(); void set(System::String ^ value); };
public string Username { get; set; }
public string? Username { get; set; }
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.DirectoryServices.DSDescription("DSUsername")]
public string Username { get; set; }
[System.ComponentModel.Browsable(false)]
[System.DirectoryServices.DSDescription("DSUsername")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string Username { get; set; }
[System.ComponentModel.Browsable(false)]
[System.DirectoryServices.DSDescription("DSUsername")]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string Username { get; set; }
member this.Username : string with get, set
[<System.ComponentModel.Browsable(false)>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
[<System.DirectoryServices.DSDescription("DSUsername")>]
member this.Username : string with get, set
[<System.ComponentModel.Browsable(false)>]
[<System.DirectoryServices.DSDescription("DSUsername")>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.Username : string with get, set
[<System.ComponentModel.Browsable(false)>]
[<System.DirectoryServices.DSDescription("DSUsername")>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.Username : string with get, set
Public Property Username As String
Valore della proprietà
Nome utente da utilizzare per l'autenticazione del client.
- Attributi
Esempio
Nell'esempio seguente vengono illustrate le Username proprietà e Password della DirectoryEntry classe . Questo esempio ottiene l'oggetto specificato DirectoryEntry dall'utente e l'oggetto di tutti i Path relativi 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 = new 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);
}
Commenti
È possibile impostare e UsernamePassword per specificare credenziali alternative con cui accedere alle informazioni in Active Directory Domain Services. Tutti gli altri DirectoryEntry oggetti recuperati da questa istanza( ad esempio, tramite Children) vengono creati automaticamente con le stesse credenziali alternative.