Get multiple connection strings from web.config

c#, connection-string, web-config

Solution

    foreach (ConnectionStringSettings c in System.Configuration.ConfigurationManager.ConnectionStrings)
    {
        //use c.Name
    }

Problem

How to get all the connection strings's names from the web.config via code in C#? I tried this: ``` System.Configuration.Configuration webConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); ConnectionStringsSection x = webConfig.ConnectionStrings; string here = x.SectionInformation.Name; ```

Original source