Wednesday, June 13, 2007

AppSettings in a file other than web.config

As the number of websites in Sharepoint increases, the bin folder gets bigger and also the web.config becomes larger. But, you can have multiple web.config's and have the Appsettings in a different file. Thanks to Mark for bringing this to my notice.You can use the file element of the appSettings attribute to specify the optional file.

Syntax:
<appsettings file="customAppSettingsFile/">
or
<appsettings file="customAppSettingsFile">
<add value="testvalue1" key="test1">
<add value="testvalue2" key="test2">
</appsettings>

You can specify the core appsettings in web.config and the extra ones in customAppSettingsFile. Any change to customAppSettingsFile will not restart the application. You have to modify web .config to make the application restart.

No comments:

Post a Comment