Tippu
Tippu

Reputation: 1261

Changeable config values

I need to store few config values which will be changed by the application administrator. I do not want to store them in web.config files, because whenever web.config file is edited the system will recompile the application.

DBA is not letting me to create a table to store it in database.

Can you suggest some way where I can store this editable values.

Thank you for the suggestion.

it is a ASP.NET application.

Upvotes: 0

Views: 320

Answers (2)

Giedrius
Giedrius

Reputation: 8540

As an alternative you could write your own ConfigSection and set restartOnExternalChanges="false".

Then, when reading the section with ConfigurationManager.GetSection("yourSection") the settings will be auto-refreshed without an application restart.

If you still wish to keep web.config untouched, you can use configSource property to set external file where your settings will be kept.

To design a new section you can use this tool: http://csd.codeplex.com/

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038890

You could store them in your own config file. For example you could put this file inside the ~/App_Data folder and then read the config file when you need the values. As far as the format of this file is concerned you have many choices: plain Text, XML, JSON, whatever you like.

Upvotes: 2

Related Questions