ASP.Net 2.0 ChangePassword Control
The ChangePassword Control in ASP.Net 2.0 provides the in-built functionality to change the password of authenticated or logged in user. ChangePassword control by default shows input fields for old Password, new password, confirm new password. First to confirm that the user has accessed the page through proper channel via login page, ChangePassword Control takes the old Password to verify the user identity in the database. Next it accepts the new password that is stored into the database after confirmation.
The ChangePassword Control also has a feature to send the confirmation email to the authenticated user that the password has been changed successfully. You can set the properties like BodyFileName, CC, EmbeddedObjects, From, IsBodyHtml, priority and subject to manage the e-mail message. MailDefinition part of the ChangePassword control also uses the values defined in web.config file under mailSettings section of system.net.
You can get more information in the previous article: ASP.Net 2.0 CreateUser Email Confirmation
Following are some properties of ChangePassword Control that customizes the behavior of change password wizard:
- CancelDestinationPageUrl: You can specify the destination page URL for the cancel button in CancelDestinationPageUrl property. Cancel button will redirect the user to the specified URL when he clicks to cancel the action.
- SuccessPageUrl: You can specify the success page URL in SuccessPageUrl property to direct the user to another page after changing the password successfully. If you will specify the SuccessPageUrl then ChangePassword Control will bypass the success view of the control.
- ContinueDestinationPageUrl: If you will not specify the SuccessPageUrl then ChangePassword control will display the success view having the continue button. You can enter the path in ContinueDestinationPageUrl property to redirect the user to another page.
- PasswordHintText: You can display the password guidelines or hint using this property e.g.: must be 8 characters and contain at least 1 non-alphabetic character.
If you are using the ChangePassword Control in the administrative control panel of your ASP.Net web site then you can use following additional properties to provide more features to the administrator:
Enter text for the link to create user page.
URL of the create user page.
You can set it true/false to display the username textbox in the ChangePassword Control. Administrator can change the password of different users by passing different username and password.