Change in web.config

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.
 
K

Karl Seguin

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
 
B

Bruce Barker

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

-- bruce (sqlwork.com)
 
S

Scott Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top