ASP.NET Syntax ASP.NET Syntax for Web Controls
Creates a user interface that enables users to change their Web site password.
Declarative Syntax
<asp:ChangePassword
AccessKey = "string"
BackColor = "color name | #dddddd"
BorderColor = "color name | #dddddd"
BorderPadding = integer
BorderStyle = "NotSet | None | Dotted | Dashed | Solid | Double | Groove |
Ridge | Inset | Outset"
BorderWidth = size
CancelButtonImageUrl = "uri"
CancelButtonText = "string"
CancelButtonType = "Button | Image | Link"
CancelDestinationPageUrl = "uri"
ChangePasswordButtonImageUrl = "uri"
ChangePasswordButtonText = "string"
ChangePasswordButtonType = "Button | Image | Link"
ChangePasswordFailureText = "string"
ChangePasswordTitleText = "string"
ConfirmNewPasswordLabelText = "string"
ConfirmPasswordCompareErrorMessage = "string"
ConfirmPasswordRequiredErrorMessage = "string"
ContinueButtonImageUrl = "uri"
ContinueButtonText = "string"
ContinueButtonType = "Button | Image | Link"
ContinueDestinationPageUrl = "uri"
CreateUserIconUrl = "uri"
CreateUserText = "string"
CreateUserUrl = "uri"
CssClass = "string"
DisplayUserName = "True | False"
EditProfileIconUrl = "uri"
EditProfileText = "string"
EditProfileUrl = "uri"
Enabled = "True | False"
EnableTheming = "True | False"
EnableViewState = "True | False"
Font-Bold = "True | False"
Font-Italic = "True | False"
Font-Names = "string"
Font-Overline = "True | False"
Font-Size = "string | Smaller | Larger | XX-Small | X-Small | Small |
Medium | Large | X-Large | XX-Large"
Font-Strikeout = "True | False"
Font-Underline = "True | False"
ForeColor = "color name | #dddddd"
Height = size
HelpPageIconUrl = "uri"
HelpPageText = "string"
HelpPageUrl = "uri"
ID = "string"
InstructionText = "string"
MailDefinition-BodyFileName = "uri"
MailDefinition-CC = "string"
MailDefinition-From = "string"
MailDefinition-IsBodyHtml = "True | False"
MailDefinition-Priority = "Normal | Low | High"
MailDefinition-Subject = "string"
MembershipProvider = "string"
NewPasswordLabelText = "string"
NewPasswordRegularExpression = "string"
NewPasswordRegularExpressionErrorMessage = "string"
NewPasswordRequiredErrorMessage = "string"
OnCancelButtonClick = "CancelButtonClick event handler"
OnChangedPassword = "ChangedPassword event handler"
OnChangePasswordError = "ChangePasswordError event handler"
OnChangingPassword = "ChangingPassword event handler"
OnContinueButtonClick = "ContinueButtonClick event handler"
OnDataBinding = "DataBinding event handler"
OnDisposed = "Disposed event handler"
OnInit = "Init event handler"
OnLoad = "Load event handler"
OnPreRender = "PreRender event handler"
OnSendingMail = "SendingMail event handler"
OnSendMailError = "SendMailError event handler"
OnUnload = "Unload event handler"
PasswordHintText = "string"
PasswordLabelText = "string"
PasswordRecoveryIconUrl = "uri"
PasswordRecoveryText = "string"
PasswordRecoveryUrl = "uri"
PasswordRequiredErrorMessage = "string"
runat = "server"
SkinID = "string"
Style = "string"
SuccessPageUrl = "uri"
SuccessText = "string"
SuccessTitleText = "string"
TabIndex = integer
ToolTip = "string"
UserName = "string"
UserNameLabelText = "string"
UserNameRequiredErrorMessage = "string"
Visible = "True | False"
Width = size
>
<CancelButtonStyle />
<ChangePasswordButtonStyle />
<ChangePasswordTemplate>
<!-- child controls -->
</ChangePasswordTemplate>
<ContinueButtonStyle />
<FailureTextStyle />
<HyperLinkStyle />
<InstructionTextStyle />
<LabelStyle />
<MailDefinition
BodyFileName = "uri"
CC = "string"
From = "string"
IsBodyHtml = "True | False"
Priority = "Normal | Low | High"
Subject = "string"
>
<EmbeddedObjects>
<asp:EmbeddedMailObject
Name = "string"
Path = "uri"
/>
</EmbeddedObjects>
</MailDefinition>
<PasswordHintStyle />
<SuccessTemplate>
<!-- child controls -->
</SuccessTemplate>
<SuccessTextStyle />
<TextBoxStyle />
<TitleTextStyle />
<ValidatorTextStyle />
</asp:ChangePassword>
For information on the individual members of this class, see ChangePassword in the class library.
The ChangePassword control enables Web site users to change the passwords they use to log on to a Web site.
Security Note: Transmitting passwords over HTTP is a potential security vulnerability, as HTTP transmissions can be viewed or compromised by malicious users. To improve security when using login controls, you should use the HTTPS protocol with secure sockets layer (SSL) encryption to ensure that the user’s password cannot be read during postback.
The ChangePassword control uses the membership provider that is defined in the MembershipProvider property to change the password that is stored in the membership provider data store for the Web site. If you do not assign a membership provider, the ChangePassword control uses the default membership provider that is defined in the membership section of the Web.config file.
The following example shows how to set the NewPasswordRegularExpression property to define a regular expression that checks passwords to ensure that they meet the following criteria:
- Are greater than six characters.
- Contain at least one digit.
- Contain at least one special ( non-alphanumeric ) character.
The password requirements that are contained in the PasswordHintText property are displayed to the user.
If the password that is entered by the user does not meet the requirements of the NewPasswordRegularExpression property, the text that is contained in the NewPasswordRegularExpressionErrorMessage property is displayed to the user. If a new password is not entered, the text that is contained in the NewPasswordRequiredErrorMessage property is displayed to the user.
NOTE: The new password must meet the minimum requirements that are set by the membership provider in the MinRequiredPasswordLength, MinRequiredNonAlphanumericCharacters, and PasswordStrengthRegularExpression properties. If the password does not meet these requirements, the ChangePasswordError event is raised.
<asp:changepassword id="ChangePassword1" runat="server"
PasswordHintText = "Please enter a password at least 7 characters long,
containing a number and one special character."
NewPasswordRegularExpression =
’@\"(?=.{7,})(?=(.*\d){1,})(?=(.*\W){1,})’
NewPasswordRegularExpressionErrorMessage =
"Error: Your password must be at least 7 characters long,
and contain at least one number and one special character.">
</asp:changepassword>
ChangePassword Class ChangePassword Web Server Control