FormsAuthenticationConfiguration.Credentials Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
FormsAuthenticationCredentials Získá kolekci uživatelských jmen a hesel.
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
Hodnota vlastnosti
FormsAuthenticationCredentials Kolekce obsahující uživatelská jména a hesla.
- Atributy
Příklady
Následující příklad kódu ukazuje, jak získat přístup k Credentials vlastnosti. V příkladu kódu v tématu předmětu FormsAuthenticationConfiguration se dozvíte, jak získat oddíl.
// 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
Poznámky
Tato Credentials vlastnost získá uživatelská jména a hesla, která se mají použít při ověřování na základě formulářů.
Poznámka
V případě potřeby zabezpečení byste měli použít alternativní způsoby ukládání uživatelských jmen a hesel; Například v úložišti databáze. Pokud se rozhodnete tuto kolekci použít, měli byste použít poskytnuté šifrovací zařízení.