SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to persist some information entered via my web part so the next time the same user uses it, the settings will be pre-populated.

In the Windows world, I would just slap the data is HKCU, but in the brave new world I have no idea what to to.

I have written some code to store values at the SPFarm level, but I can't seem to figure out the site level.

Any advice?


share|improve this question

Do you have a button on the web part to save the property? If so, just write the data to a public property on the web part with it's PersonalizationScope set to User. Thus, the property will be stored against the user.

share|improve this answer

You can use an SPPersistedObject on SPFarm or SPWebApplication level. The PropertyBag can be used on sites via SPWeb.Properties. But I would not store user-specific data in either of these stores. I would go with James' suggestion or put the data in a SQL database...

share|improve this answer

If you have SharePoint Server you could try using the UserProfile class and creating a custom profile property with your preferences.

Links: Technet, MSDN.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.