TAILIEUCHUNG - ASP.NET 4 Unleased - p 120

Định dạng hình 26,6 kiểm soát CreateUserWizard. Đây là những mặc định biểu mẫu form. Ba lĩnh vực cuối cùng là tuỳ chọn. Nếu bạn không muốn yêu cầu một người sử dụng để nhập hoặc một địa chỉ email hoặc câu hỏi bảo mật và câu trả lời, bạn cần phải sửa đổi cấu hình của nhà cung cấp thành viên mặc định. | 1164 CHAPTER 26 Using the Login Controls FIGURE Formatting the CreateUserWizard control. These are the default form fields. The last three fields are optional. If you don t want to require a user to enter either an email address or a security question and answer you need to modify the configuration of the default membership provider. The web configuration file in Listing makes both an email address and security question and answer optional. LISTING xml version encoding utf-8 configuration authentication mode Forms membership defaultProvider MyMembership providers add name MyMembership type connectionStringName LocalSqlServer requiresQuestionAndAnswer false requiresUniqueEmail false From the Library of Wow eBook Using the CreateUserWizard Control 1165 providers membership configuration If you add the web configuration file in Listing to your application the CreateUserWizard control does not render fields for a security question and answer. However the CreateUserWizard control still renders an email field. If you don t want the email form field to be rendered you must perform an additional step. You must set the CreateUserWizard control s RequireEmail property to the value False. If you add the page in Listing to an application that contains the web configuration file in Listing the email security question and security answer form fields are not displayed see Figure . FIGURE An abbreviated registration form. 26 LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD html xmlns http 1999 xhtml head id Head1 runat server From the Library of Wow eBook 1166 CHAPTER 26 Using the Login Controls title CreateUserWizard Short title head body form id form1 runat server div asp CreateUserWizard id CreateUserWizard1 RequireEmail false