About web configration
how to Changing Web configuration at
run time.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manoj BhoirRank #599 · 4K reputationPosted Aug 8, 2015, 5:55 AM EDT
Read and Modify Web.Config file through C# code
Change a web.config programmatically with C# (.NET)
Jignesh TrivediRank #16 · 50.3K reputationPosted Aug 9, 2015, 8:00 PM EDT
Hi,
Web config is XML file, so you can change it by using c# code.
but If you change it runtime, application pool will be recycled.
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 9, 2015, 8:45 PM EDT
Web config is an XML file, so you can change it by using c# code but If you change it runtime then application pool will be recycled.
var configuration = WebConfigurationManager.OpenWebConfiguration("~"); var section = (ConnectionStringsSection)configuration.GetSection("connectionStrings"); section.ConnectionStrings["MyConnectionString"].ConnectionString = "Data Source=..."; configuration.Save();Narasimha Reddy ChennupalliRank #1,163 · 1.6K reputationPosted Aug 10, 2015, 10:44 PM EDT