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:
Add a drop-down list or other control to allow selection of the authentication option.
Add a drop-down list or other control to allow selection of the inactive period.
Add a button to initiate the search for the profile.
Add a
GridView
to display the profiles matching the search parameters.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:
Initialize the authentication option drop-down control with the available options.
Initialize the inactive period drop-down control with the available options.
In the event handler for the Search button click event, use the
GetAllInactive-Profiles
method of theProfileManager
class to get the profiles matching the search parameters and then bind the profile data to aGridView
.In the event handler for the Delete All button click event, use the
DeleteInactiveProfiles
method of theProfileManager
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.