System.Web.UI.WebControls Namespace
.NET Framework version 2.0
Provides user interface ( UI ) elements that enable a user to recover or reset a lost password and receive it in e-mail.
Visibility |
Name |
Value Type |
Accessibility |
public |
Answer
|
String |
[ Get ] |
public |
AnswerLabelText
|
String |
[ Get , Set ] |
public |
AnswerRequiredErrorMessage
|
String |
[ Get , Set ] |
public |
BorderPadding
|
Int32 |
[ Get , Set ] |
public |
FailureTextStyle
|
TableItemStyle |
[ Get ] |
public |
GeneralFailureText
|
String |
[ Get , Set ] |
public |
HelpPageIconUrl
|
String |
[ Get , Set ] |
public |
HelpPageText
|
String |
[ Get , Set ] |
public |
HelpPageUrl
|
String |
[ Get , Set ] |
public |
HyperLinkStyle
|
TableItemStyle |
[ Get ] |
public |
InstructionTextStyle
|
TableItemStyle |
[ Get ] |
public |
LabelStyle
|
TableItemStyle |
[ Get ] |
public |
MailDefinition
|
MailDefinition |
[ Get ] |
public |
MembershipProvider
|
String |
[ Get , Set ] |
public |
Question
|
String |
[ Get ] |
public |
QuestionFailureText
|
String |
[ Get , Set ] |
public |
QuestionInstructionText
|
String |
[ Get , Set ] |
public |
QuestionLabelText
|
String |
[ Get , Set ] |
public |
QuestionTemplate
|
ITemplate |
[ Get , Set ] |
public |
QuestionTemplateContainer
|
Control |
[ Get ] |
public |
QuestionTitleText
|
String |
[ Get , Set ] |
public |
RenderOuterTable
|
Boolean |
[ Get , Set ] |
public |
SubmitButtonImageUrl
|
String |
[ Get , Set ] |
public |
SubmitButtonStyle
|
Style |
[ Get ] |
public |
SubmitButtonText
|
String |
[ Get , Set ] |
public |
SubmitButtonType
|
ButtonType |
[ Get , Set ] |
public |
SuccessPageUrl
|
String |
[ Get , Set ] |
public |
SuccessTemplate
|
ITemplate |
[ Get , Set ] |
public |
SuccessTemplateContainer
|
Control |
[ Get ] |
public |
SuccessText
|
String |
[ Get , Set ] |
public |
SuccessTextStyle
|
TableItemStyle |
[ Get ] |
public |
TextBoxStyle
|
Style |
[ Get ] |
public |
TextLayout
|
LoginTextLayout |
[ Get , Set ] |
public |
TitleTextStyle
|
TableItemStyle |
[ Get ] |
public |
UserName
|
String |
[ Get , Set ] |
public |
UserNameFailureText
|
String |
[ Get , Set ] |
public |
UserNameInstructionText
|
String |
[ Get , Set ] |
public |
UserNameLabelText
|
String |
[ Get , Set ] |
public |
UserNameRequiredErrorMessage
|
String |
[ Get , Set ] |
public |
UserNameTemplate
|
ITemplate |
[ Get , Set ] |
public |
UserNameTemplateContainer
|
Control |
[ Get ] |
public |
UserNameTitleText
|
String |
[ Get , Set ] |
public |
ValidatorTextStyle
|
Style |
[ Get ] |
|
The PasswordRecovery control assists users who have forgotten their passwords. It enables a user to request an e-mail message containing either a new password or the password already associated with his or her user name.
NOTE: The PasswordRecovery Web control uses Internet e-mail services to send recovered or new passwords to users. There are inherent security risks with sending passwords in e-mail. You should determine whether these security risks are acceptable to your site.
Users can recover passwords only when the membership provider defined in the MembershipProvider property supports clear text or encrypted passwords. Because hashed passwords cannot be recovered, users at sites that use hashed passwords can only reset their passwords.
NOTE: Accepting user input is a potential security threat. Malicious users can send data that is intended to expose vulnerabilities or run programs that try generated passwords. To improve security when working with user input, you should use the validation features of your control and secure any data providers that are configured for your control. For more information, see Securing Login Controls, Basic Security Practices for Web Applications, and Securing Membership.
NOTE: The PasswordRecovery control can be used when a membership user has not been approved ( MembershipUser.IsApproved is set to false ), but it cannot be used when a membership user has been locked out ( MembershipUser.IsLockedOut is set to true ).
The e-mail message is sent using the MailDefinition class. To be able to send e-mail to users, you must configure a mail server in your application's Web.config file. You can change the content of the e-mail sent to users by setting a custom message in the MailDefinition property.
The PasswordRecovery control has three states, or views:
- UserName view -- Asks the user for his or her registered user name.
- Question view -- Requires the user to provide the answer to a stored question to reset the password.
- Success view -- Tells the user whether the password recovery or reset was successful.
The PasswordRecovery control displays the Question view only when the membership provider defined in the MembershipProvider property supports password question and answer.
The following table lists each style property of the PasswordRecovery control and indicates which view it affects.
You can use an extensive set of style properties to customize the appearance of the PasswordRecovery control. Alternatively, you can apply custom templates to the three views if you need complete control over the appearance of the control. You can use the QuestionTemplate, SuccessTemplate and UserNameTemplate properties to create templates for these views. If you define a template for a view, the style properties of PasswordRecovery have no effect.
The following table lists the PasswordRecovery control style properties and explains which UI element each style property affects. For a list of which properties each style applies to, see the documentation for the individual style properties.
Style property |
UI element affected |
SubmitButtonStyle |
Submit buttons on all views. |
FailureTextStyle |
Error text displayed to the user. |
HyperLinkStyle |
Links to other pages. |
InstructionTextStyle |
Instructional text on the page that tells users how to use the control. |
LabelStyle |
Labels for all input fields, such as text boxes. |
TextBoxStyle |
Text entry input fields. |
TitleTextStyle |
Title text for each view. |
SuccessTextStyle |
Text displayed to the user when the password recovery or reset attempt is successful. |
The following table lists which template properties apply to each view in the PasswordRecovery control. For a list of the controls that you must set in each template, see the documentation for the individual template properties.
View |
Template property |
UserName |
UserNameTemplate |
Question |
QuestionTemplate |
Success |
SuccessTemplate |
When the PasswordRecovery control is not customized with templates, the AccessKey property of the PasswordRecovery control applies to the first text box in the control and the TabIndex property, which is applied to all text boxes of the control. If the PasswordRecovery control is customized with templates, then the AccessKey property and the TabIndex property are ignored. In this case, set the AccessKey property and the TabIndex property of each template child control directly.
PasswordRecovery control properties represented by text boxes, such as Answer and Question, are accessible during all phases of the page life cycle. The control will pick up any changes made by the end user by means of the TextChanged event triggered by the textboxes.
The PasswordRecovery control creates a validation group for all required field validators in the control so that other input controls on the page are not affected by validating the PasswordRecovery control. By default, the ID property of the PasswordRecovery control is used as the name of the validation group. For example, a PasswordRecovery control with the ID
"PasswordRecovery1" will use a validation group name of "PasswordRecovery1". If you want the PasswordRecovery control to participate in another validation group, you must template the control.
For examples illustrating use of this control, see the individual member types of this class. For syntax information, see PasswordRecovery in ASP.NET Syntax for Web Controls.
ASP.NET Login Controls PasswordRecovery Web Server Control