I want to read all the connection strings from web.config programmatically without specifying the names of the connection strings. And use that information for different purposes e.g. print out on the screen. Is it possible and how can I do that?
Thanks,
You obviously did not try anything. This would do it
foreach (var s in System.Web.Configuration.WebConfigurationManager.ConnectionStrings)
{
Response.Write(s);
}
Where ConnectionStrings is a collection of ConnectionStringSettings
foreach (System.Configuration.ConnectionStringSettings s in System.Web.Configuration.WebConfigurationManager.ConnectionStrings)
{
Response.Write(s);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With