I am creating a webpart that connects to another server in order retrieve data. This webpart has some settings that are the same for all instances i.e. Username, Password, Url ... Is it possible to store those values in a common place so that I can change them in the future and every instances should be affected? It is important that the users can't see the settings or edit them.
A:
If you already store that configuration into webpart, you don't need to change anything. Just create a ToolPart
and define an authorization model (ie, just Administrators will update it).
If even Administrators shouldn't change that values, I recommend to define them at your <appSettings>
section into your web.config file.
Rubens Farias
2010-01-25 09:32:53
It would be great if it is possible to change the settings inside SharePoint, but the thing is that it needs be changed for instances of the webpart and for all site collections, is that possible? So if it have a setting called server, which is server1 if I change it to server2 I want it ot be changed for all the webparts
unkown
2010-01-25 12:14:34
A:
It really depends on at which level you want to be able to specify the settings
If it's at Site or SiteCollection level then using the SPWeb.Properties property bag is the best choice
If you need to protect the setting from users with access to the object model then you should encrypt the settings
Per Jakobsen
2010-01-25 10:01:37