What is the "correct" .NET 2.0 way to do this from within a class
library?
For example, say I have a connection string in app.config or web.config
added using the VS2005 IDE, like so:
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="ProjectName.My.MySettings.Connect1"
connectionString="Data Source=x;Initial
Catalog=y;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
How do I get the above setting in a way that works from both WinForms
and ASP.NET applications? The class is in a DLL which could be called
from either type of client.
The Patterns and Practices Enterprise Library (November CTP for .NET
2.0) uses ConfigurationManager to do it, but MSDN Help says this:
"Using WebConfigurationManager is the preferred way to work with
configuration files related to Web applications; all other methods are
deprecated. For client applications, we recommend that you use the
ConfigurationManager."
If Enterprise Library is an implementation of Microsoft best practices,
then why is it using a deprecated method for reading configuration?
Thanks,
Chris