Reputation: 471
Is is possible to add or change connection in the connection string in the App.config, programmatically? I've tried something with
var A = ConfigurationManager.ConnectionStrings;
A.Add(new ConnectionStringSettings());
but i got a message that it's read only.
Please help
Upvotes: 1
Views: 571
Reputation: 25234
Any modification to the configuration file of a web application requires IIS to restart. As such, you cannot make a runtime modification to the file from your code because it would require restarting the entire application.
Upvotes: 1