FormsAuthenticationUserCollection.Set(FormsAuthenticationUser) Metoda
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í.
Upraví zadaný FormsAuthenticationUser objekt obsažený v kolekci.
public:
void Set(System::Web::Configuration::FormsAuthenticationUser ^ user);
public void Set (System.Web.Configuration.FormsAuthenticationUser user);
member this.Set : System.Web.Configuration.FormsAuthenticationUser -> unit
Public Sub Set (user As FormsAuthenticationUser)
Parametry
Objekt FormsAuthenticationUserCollection , který musí být změněn.
Příklady
Následující příklad kódu ukazuje, jak použít metodu Set .
// Using method Set.
// Define the SHA1 encrypted password.
string newPassword =
"5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8";
// Define the user name.
string currentUserName = "userName";
// Create the new user.
FormsAuthenticationUser theUser =
new FormsAuthenticationUser(currentUserName, newPassword);
formsAuthenticationCredentials.Users.Set(theUser);
if (!authenticationSection.SectionInformation.IsLocked)
{
configuration.Save();
}
' Using method Set.
' Define the SHA1 encrypted password.
Dim newPassword As String = _
"5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8"
' Define the user name.
Dim currentUserName As String = "userName"
' Create the new user.
Dim theUser _
As New FormsAuthenticationUser(currentUserName, newPassword)
formsAuthenticationCredentials.Users.Set(theUser)
If Not authenticationSection.SectionInformation.IsLocked Then
configuration.Save()
End If
Platí pro
Spolupracujte s námi na GitHubu
Zdroj tohoto obsahu najdete na GitHubu, kde můžete také vytvářet a kontrolovat problémy a žádosti o přijetí změn. Další informace najdete v našem průvodci pro přispěvatele.