Wednesday, April 16, 2008

Reseting user personalization state

To manage personalization state of users, you must use the PersonalizationAdministration class. The following example shows how te reset state of the current user:


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


To reset state of a particular user, use the following code snippet:


For managing user state, refer to http://msdn2.microsoft.com/en-us/library/ms366517.aspx


// Reset the user.
if (! PersonalizationAdministration.ResetUserState("~/Default.aspx", txtUser.Text))
{
Response.Write("The user could not be found or the user has not personalized this page");
}

No comments: