FormsAuthenticationConfiguration.Credentials Właściwość

Definicja

FormsAuthenticationCredentials Pobiera kolekcję nazw użytkowników i haseł.

public:
 property System::Web::Configuration::FormsAuthenticationCredentials ^ Credentials { System::Web::Configuration::FormsAuthenticationCredentials ^ get(); };
[System.Configuration.ConfigurationProperty("credentials")]
public System.Web.Configuration.FormsAuthenticationCredentials Credentials { get; }
[<System.Configuration.ConfigurationProperty("credentials")>]
member this.Credentials : System.Web.Configuration.FormsAuthenticationCredentials
Public ReadOnly Property Credentials As FormsAuthenticationCredentials

Wartość właściwości

Kolekcja zawierająca FormsAuthenticationCredentials nazwy użytkowników i hasła.

Atrybuty

Przykłady

Poniższy przykład kodu pokazuje, jak uzyskać dostęp Credentials do właściwości. Zapoznaj się z przykładem kodu w temacie klasy, FormsAuthenticationConfiguration aby dowiedzieć się, jak uzyskać sekcję.

// Get the current Credentials.
FormsAuthenticationCredentials currentCredentials = 
    formsAuthentication.Credentials;

StringBuilder credentials = new StringBuilder();
// Get all the credentials.
for (System.Int32 i = 0; i < currentCredentials.Users.Count; i++)
{
    credentials.Append("Name: " + 
        currentCredentials.Users[i].Name + 
        " Password: " + 
        currentCredentials.Users[i].Password);
    credentials.Append(Environment.NewLine);
}
' Get the current Credentials.
  Dim currentCredentials _
  As FormsAuthenticationCredentials = _
  formsAuthentication.Credentials

Dim credentials As New StringBuilder()
' Get all the credentials.
Dim i As System.Int32
For i = 0 To currentCredentials.Users.Count - 1
      credentials.Append(("Name: " + _
      currentCredentials.Users(i).Name + _
      " Password: " + _
      currentCredentials.Users(i).Password))
   credentials.Append(Environment.NewLine)
  Next i

Uwagi

Właściwość Credentials pobiera nazwy użytkowników i hasła do użycia podczas uwierzytelniania opartego na formularzach.

Uwaga

Jeśli wymagane jest bezpieczeństwo, należy użyć alternatywnych sposobów przechowywania nazw użytkowników i haseł; na przykład w magazynie bazy danych. Jeśli zdecydujesz się korzystać z tej kolekcji, należy użyć dostarczonego obiektu szyfrowania.

Dotyczy