The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
WebConfigurationManager::ConnectionStrings Property
.NET Framework (current version)
Gets the Web site's connection strings.
Assembly: System.Web (in System.Web.dll)
public: property ConnectionStringSettingsCollection^ ConnectionStrings { static ConnectionStringSettingsCollection^ get(); }
Property Value
Type: System.Configuration::ConnectionStringSettingsCollection^A ConnectionStringSettingsCollection object that contains the contents of the ConnectionStringsSection object for the current Web application's default configuration.
| Exception | Condition |
|---|---|
| ConfigurationErrorsException | A valid ConnectionStringSettingsCollection object could not be retrieved. |
The following example shows how to use the ConnectionStrings property to access configuration information and enumerate the results. To access a specific connection string, use the returned ConnectionStringSettingsCollection with the name of the desired connection string as an indexer.
.NET Framework
Available since 2.0
Available since 2.0
Show: