I have an ASP.NET project which has already some custom fields in it’s web.config file. I’ve added in it three more fields and used them in my changes, and it’s working great.
But where it needs to be used, there aren’t these thre fields in the web.config (this was expected, I’ve just added by hand for tests and developing).
How do I check the existance of fields in web.config, and in case of not finding it, how do I add it permanently to the web.config ?
Thank you
you can do something like this to see if the key exists in the config:
For the other part of your question, you could probably add stuff through the WebConfigurationManager class.
Edit:
I generally save stuff in a database rather than a configuration file if the potential exists to add stuff dynamically, but that’s just me.