Freigeben über


How to: Enable Users to Clear Personalization State

In an ASP.NET Web application that uses personalization, some circumstances might require you to remove entries from the personalization store. The simplest approach is to expose the ResetPersonalizationState method through a control on the page so that individual users can remove all personalization data that pertains to them.

To manage the personalization data of multiple users, you must use the various methods of the PersonalizationAdministration class. For more information, see How to: Remove User Entries from the Personalization Store.

Procedure

To enable users to clear their personalization state

  1. Place a Button or other control on the page to receive user input.

  2. In the relevant event handler for that control, call the ResetPersonalizationState method of the WebPartPersonalization instance available from the local WebPartManager control, as shown in the following example.

    Dim mgr As WebPartManager
    mgr = WebPartManager.GetCurrentWebPartManager(Page)
    mgr.Personalization.ResetPersonalizationState()
    
    WebPartManager mgr = WebPartManager.GetCurrentWebPartManager(Page);
    mgr.Personalization.ResetPersonalizationState();
    

    This results in a call to the ResetPersonalizationState method.

See Also

Tasks

How to: Remove User Entries from the Personalization Store

Walkthrough: Creating a Web Parts Page

Concepts

Web Parts Personalization Overview

Reference

WebPartManager

ResetPersonalizationState