TAILIEUCHUNG - ASP.NET 4 Unleased - p 123

Sau khi bạn mở trang trong Ví dụ 26,34 trong trình duyệt web của bạn, bạn là lần đầu tiên yêu cầu nhập tên người dùng (xem hình 26,15). Tiếp theo, bạn được yêu cầu nhập câu trả lời cho câu hỏi bảo mật mà bạn đã nhập khi đăng ký. Cuối cùng, mật khẩu được gửi đến tài khoản email đăng ký của bạn. | 1194 CHAPTER 26 Using the Login Controls asp PasswordRecovery id PasswordRecovery1 CssClass passwordRecovery TitleTextStyle-CssClass passwordRecovery_title InstructionTextStyle-CssClass passwordRecovery_instructions SubmitButtonStyle-CssClass passwordRecovery_button Runat server MailDefinition From Admin@ Subject Password Reminder asp PasswordRecovery div form body html After you open the page in Listing in your web browser you are first asked to enter your username see Figure . Next you are asked to enter the answer to the security question that you entered when registering. Finally a password is emailed to your registered email account. FIGURE Retrieving a lost password with the PasswordRecovery control. From the Library of Wow eBook Using the PasswordRecovery Control 1195 NOTE Before you use the PasswordRecovery control you must specify your mail server settings in your application s web configuration file. See the earlier section in this chapter Sending a Create User Email Message. By default the PasswordRecovery control first resets your password before sending you the password. In the next section you learn how to send a user s original password. Sending the Original Password By default the PasswordRecovery control does not send a user s original password. If you don t want the PasswordRecovery control to reset a user s password before sending it you must change the configuration of the membership provider. Three configuration settings matter passwordFormat enablePasswordRetrieval and enablePasswordReset. By default the passwordFormat attribute has the value Hashed. When passwords are hashed the PasswordRecovery control cannot send a user s original password. This limitation makes sense because when passwords are hashed the actual passwords are never stored anywhere. If you want to send a user his original password you need to set the passwordFormat attribute to either the value Clear or Encrypted. By default the .