FormsAuthenticationUserCollection.Set Method (FormsAuthenticationUser)

 

Modifies the specified FormsAuthenticationUser object contained in the collection.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

public void Set(
	FormsAuthenticationUser user
)

Parameters

user
Type: System.Web.Configuration.FormsAuthenticationUser

The FormsAuthenticationUserCollection object that must be changed.

The following code example shows how to use the Set method.

// 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();
}

.NET Framework
Available since 2.0
Return to top
Show: