DirectoryEntry.Password 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定要在驗證用戶端時使用的密碼。
public:
property System::String ^ Password { void set(System::String ^ value); };
public:
property System::String ^ Password { System::String ^ get(); void set(System::String ^ value); };
public string Password { set; }
public string? Password { set; }
[System.ComponentModel.Browsable(false)]
[System.DirectoryServices.DSDescription("DSPassword")]
public string Password { get; set; }
[System.ComponentModel.Browsable(false)]
[System.DirectoryServices.DSDescription("DSPassword")]
public string Password { set; }
member this.Password : string
[<System.ComponentModel.Browsable(false)>]
[<System.DirectoryServices.DSDescription("DSPassword")>]
member this.Password : string with get, set
[<System.ComponentModel.Browsable(false)>]
[<System.DirectoryServices.DSDescription("DSPassword")>]
member this.Password : string
Public Property Password As String
屬性值
驗證用戶端時所要使用的密碼。
- 屬性
範例
下列範例示範 Username 類別的 DirectoryEntry 和 Password 屬性。 這個範例會取得使用者指定的 DirectoryEntry 及其 Path 所有 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);
}
備註
您可以設定 Username 和 Password 屬性,以指定要用來存取 Active Directory 網域服務 中資訊的替代認證。 例如,從這個實例擷取的任何其他 DirectoryEntry 物件 (,都會 Children 使用相同的替代認證自動建立) 。