Dear Dave,
ConfigurationManager Class
===================
One important new configuration-related class is the ConfigurationManager
class, which provides seamless programmatic access to configuration files and
configuration sections. Using the methods and properties of this class, you
can open configuration files and retrieve configuration sections from within
your application.
It gives Quick access to the appSettings and connectionStrings sections of
the current application's default configuration file, which you access
through properties such as AppSettings and ConnectionStrings
Note: The ASP.NET process account needs sufficient permissions to be able to
read and write into the specified configuration file.
For simplicity, to run the tryouts, enable Integrated Windows authentication
through IIS and enable impersonation at the Web site level using the
following configuration settings under the <system.web> element in the
web.config file.
<identity impersonate="true"/>
One of the Property = ConnectionStrings
This property gets the appropriate data from the <ConnectionStrings> section
of the current application's configuration file.
Retrieving Connection Strings
===================
..NET 2.0 introduces a new configuration section called <connectionStrings>
that lets you store connection strings securely in a .NET application.
These Steps will show you how to read the connection string that is stored
inside the <connectionStrings> section in a web.config file.
Step :1
--------------
First, you need to prepare your web.config file. For example, here's a
portion of a web.config that contains a <connectionString> entry.
<connectionStrings>
<add name="pubs"
connectionString="localhost;integrated
security=true;database=pubs;" />
</connectionStrings>
The following code retrieves that connection string from the web.config file
using the ConnectionStrings property of the ConfigurationManager class.
ConfigurationManager.ConnectionStrings["pubs"].ConnectionString
or
You can simply output the Connection String for example:
Response.Write("Connection String:"
+ ConfigurationManager. ConnectionStrings["pubs"].ConnectionString);
Bye
Venkat_KL