Learn how to programmatically modify user's account information using the Membership class.
So far, you have seen how to modify users' information using the built-in controls that ship with ASP.NET 2.0. A much more versatile approach would be to modify user data programmatically. The Membership class makes this possible and is, in fact, the source of many of the APIs driving all the new Login controls in ASP.NET 2.0.
In this lab, you will learn how to programmatically modify and access a user's settings. You will create a Web Form and populate it with text boxes and Button controls to let users perform tasks such as changing their passwords and identity validation questions, as well as updating their email addresses. All these tasks will be performed using the Membership and MembershipUser classes.
Using the same project created in the last lab (C:\ASPNET20\chap-5-SecurityControls), add a new Web Form to the project (right-click the Members folder in Solution Explorer and then select Add New Item...; select Web Form). Name the Web Form UserInfo.aspx.
Add a 3 6 table to the Web Form (Layout→ Insert Table) and populate it with the controls shown in Figure 5-36.
Figure 5-36. The various controls on the UserInfo.aspx page
When the form is first loaded, retrieve the user's information using the GetUser( ) method from the Membership class. It returns ...