When I change the connection string using this code, it does not reload app.config
at runtime. I expected it to reload similarly to how we reload app.conf
Yeah, when ASP.NET web.config gets updated, the whole application gets restarted which means the web.config gets reloaded.
IIRC, the ConfigurationManager.RefreshSection requires a string parameter specifying the name of the Section to refresh :
ConfigurationManager.RefreshSection("connectionStrings");
I think that the ASP.NET application should automatically reload when the ConnectionStrings element is modified and the configuration does not need to be manually reloaded.