DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Read Connection String From Web.config

02.02.2006
| 109257 views |
  • submit to reddit
        web.config
<connectionStrings>
   <add name="ConnectionString" connectionString="Server=xxx; Port=3306; Database=xxx; uid=xxx; pwd=xxx;" />
</connectionStrings>


c#
System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString