How to get object of PersonalizationProvider of WebParts in ASP.NET?

43 Views Asked by At

There is SqlPersonalizationProvider and I have also defined other CustomPersonalizationProvider In the page where I have multiple webparts, I need to have functionality to reset the state of Webparts to emply or delete the state.

There exists a defined method System.Web.UI.WebControls.WebParts.PersonalizationProvider.ResetState which can be called, with page path and username. I could not find a way to get object of current provider, so I can call this method to delete state.

1

There are 1 best solutions below

0
On

I found that we can get Current Providers using PersonalizationAdministration.Provider and to reset state there are methods in providers like:

PersonalizationAdministration.Provider.ResetState(PersonalizationScope.Shared, paths, null);
or
PersonalizationAdministration.Provider.ResetState(PersonalizationScope.Private, paths, username);