Change the connection string in the web.config programmatically using c#
Posted on 2012-03-23
I have been searching for a way to change my connection string at runtime in a windows c# .net application. I have used code like the following...
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.ConnectionStrings.ConnectionStrings["MyConnection"].ConnectionString = PassMan.CurrentConnectionString;
But nothing seems to be happening to the web.config file?
Your help would be appreciated.