I have the following code in which I want to change the default database in code behind.
Web.config
<dataConfiguration defaultDatabase="olddatabasename"/>
My code behind
DatabaseSettings dbSettings = (DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration");
dbSettings.DefaultDatabase = "newdatabasename";
But it gives the following error:
The configuration is read only
How can I change this in code behind?