10.4. Managing User Profiles

Problem

You want to provide a mechanism to periodically remove user profile data that is no longer being used.

Solution

Use the ProfileManager class to find inactive profiles, display them in an ASP.NET page for the manager to review, and then use the ProfileManager to delete the desired profiles.

In the .aspx file:

  1. Add a drop-down list or other control to allow selection of the authentication option.

  2. Add a drop-down list or other control to allow selection of the inactive period.

  3. Add a button to initiate the search for the profile.

  4. Add a GridView to display the profiles matching the search parameters.

  5. Provide the ability to delete one or more profiles.

In the code-behind class for the page, use the .NET language of your choice as follows:

  1. Initialize the authentication option drop-down control with the available options.

  2. Initialize the inactive period drop-down control with the available options.

  3. In the event handler for the Search button click event, use the GetAllInactive-Profiles method of the ProfileManager class to get the profiles matching the search parameters and then bind the profile data to a GridView.

  4. In the event handler for the Delete All button click event, use the DeleteInactiveProfiles method of the ProfileManager class to delete the displayed profiles.

The code we have created to illustrate this solution is shown in Examples 10-11, 10-12 through 10-13. Example 10-11 shows the .aspx file for the page used to manage profiles. The code-behind classes ...

Get ASP.NET 2.0 Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.