You can use ConfigurationManager.ConnectionStrings
to read the connection strings from the connection string section of your web.config
file.
Or you can use ConfigurationManager.GetSection
to get a section from the config file. If it is a predefined section you can cast it to this type, or you can implement your own custom section (see System.Configuration.ConfigurationSection
for a sample).
Oh yes ... you have to include the System.Configuration
into your references to work with these classes.