Change in web.config

  • Thread starter Thread starter PawelR
  • Start date Start date
P

PawelR

Hello group,
In my applicationa I use web.config parameter for sqlConnectionString etc.
How change parameter in web.config via website - one of site in my
application - as opiton/seting site.

Thx.
PawelR.
 
There's no easy way to interact with writing to web.config. You have to use
the classes inside System.XML to modify the .config file like any other xml
file..

Karl
 
note: if your app writes to the web config. it will force a recycle

-- bruce (sqlwork.com)
 
Hello group,
In my applicationa I use web.config parameter for sqlConnectionString etc.
How change parameter in web.config via website - one of site in my
application - as opiton/seting site.


If you are using ASP.NET 2.0 you can use the config API to write to
web.config (and other configuration files). I have some examples in
this article: http://odetocode.com/Articles/418.aspx.

It's also possible to avoid an application restart. You'll have to
move the section into an external file
(configSource="connections.config") and modify the connectionsStrings
element under <configSections> in machine.config with
restartOnExternalChanges="false". The article goes into some detail on
this topic also.
 
Back
Top