So why is it that you want to use the settings from the db instead of just putting them in Web.config?
I assumed you were wanting to do that to have different smtp server per site in a multi site installation.
In either case where in the code, at what event do you make these config changes?
Certainly don't want that code to execute very often.
The problems I see with this approach are:
-
In order for that config.Save() to work, the Web.config must be writable by the web process user which is not a good security strategy.
-
Whenever the Web.config gets modified it will recycle the application
-
I'm pretty sure that would not work in Medium Trust and would throw a security exception
Best,
Joe